121

I cant find more information about those.

Should we use docker stop for containers which we started with docker start

Or same for docker-compose up?

What is the difference between stop and down?

4 Answers 4

111

In docker-compose help

stop               Stop services

down               Stop and remove containers and networks (optionally images and volumes as well)
2
103
# Stop services only
docker-compose stop

# Stop and remove containers, networks..
docker-compose down 

# Down and remove volumes
docker-compose down --volumes 

# Down and remove images
docker-compose down --rmi <all|local> 
1
25

Following are the differences among various docker-compose command options:

docker-compose up - start and restart all the services defined in docker-compose.yml

docker-compose down - command will stop running containers, but it also removes the stopped containers as well as any networks that were created. You can take down one step further and add the -v flag to remove all volumes too. This is great for doing a full blown reset on your environment by running docker-compose down -v.

docker-compose start - command will only restart containers stopped previously

docker-compose stop - command will stop running containers but won’t remove them

10

Just to answer the other part of the question:

Use docker-compose up to start or restart all the services defined in a docker-compose.yml.

The docker-compose start command is useful only to restart containers that were previously created, but were stopped. It never creates new containers.

The docker-compose run command is for running “one-off” or “adhoc” tasks.

For further information visit this page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.