john
john

Reputation: 1280

How do I restart a Docker container/image/machine?

I'm trying to teach myself about Docker and using the docker-compose.yml to play around with images and the compose file. I've got the Wordpress image up and running using successfully docker-compose.yml up -d via the tutorial here... https://docs.docker.com/compose/wordpress/), but as soon as I make changes to the compose file and docker-compose.yml up -d again I can't access the changes again and have to completely delete images/containers/docker machine's to get my changes to work.

What am I doing wrong, what's the process to restart/delete the minimum amount to see my docker-compose.yml changes so I can play around with docker-compose.yml?

Upvotes: 0

Views: 2957

Answers (1)

Eugen Mayer
Eugen Mayer

Reputation: 9934

docker-compose stop to stop the stack docker-compose start to start the stack

Both above will not remove your container, but rather shutdown and start them again, without any loses, even on the container filesystem, not only the volumes

docker-compose down will remove the containers of your services and all anonymous volumes assigned to them.

Be aware, not all changes in the docker-compose file can be applied using start/stop, rather most of the time, you have to do a down/up. Things like volumes/ports cannot be hot-applied like this.

Upvotes: 3

Related Questions