This is my command:
docker run -d --name di MY_DOCKER_IMAGE/cli start accept --token your_token_here
I want to run the contaniner with my image and this parameters from Dockerfile.
Example:
FROM my_docker_image:latest
CMD -d --name di MY_DOCKER_IMAGE/cli start accept --token your_token_here
Something like this that when runs the container image runs with the specified parameters and not just pull the image.
Thanks
2
Answers
The
CMD
command is just to run one command INSIDE the container. If you want to run something like you descripted in your post you should take a look atdocker-compose
like @Jeffrey Mixon mentioned.With docker compose, you can run your container with those parameters by doing
Create a file called docker-compose.yml and put this inside it
Then, when you do
docker compose up -d
, your container will be started with the same parameters as in yourdocker run
command.Depending on your version of docker compose, you might have to use
docker-compose up -d
(with a dash in ‘docker-compose’).