docker-compose up, down, stop start difference
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
# 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>
In docker-compose help
stop Stop services
down Stop and remove containers and networks (optionally images and volumes as well)