Reputation: 3402
I am writing a Makefile for my Docker app. I have make start-image
, which starts the image with it's default command:
start-image:
docker run name
I would like to have another command make do_something
which would append the command that should be run within the docker container:
do_something:
docker run name command args
How can I use the start-image command to do that?
Upvotes: 1
Views: 270
Reputation: 6468
Use a variable to store the common part of the commands
RUNTOOL=docker run name
start-image:
${RUNTOOL}
do-something:
${RUNTOOL} command args
With this strategy, it is also possible to build the RUNTOOL variable out of smaller parts to accomodate for more complex tasks.
Upvotes: 1
Reputation: 99124
start-image:
docker run name $(ARGS)
do_something: ARGS=command args
do_something: start-image
Upvotes: 0