docker-compose down
does not have a [SERVICE...]
argument.
Per docker-compose down --help
:
Usage: down [options]
I would like to be able to bring just one of my many containers down. I know that I can down a single container using docker down
instead of docker-compose down
, but I'm wondering why doesn't the docker-compose down
command take an optional [SERVICE...]
argument?
All of the following docker-compose commands do take an optional [SERVICE...]
argument:
docker-compose build
docker-compose create
docker-compose kill
docker-compose logs
docker-compose pause
docker-compose restart
docker-compose rm
docker-compose start
docker-compose stop
docker-compose unpause
docker-compose up
My docker-compose --version
is 1.9.0
The following command is the equivalent of docker down
for a single service:
docker-compose rm -s -v my_service
Usage: rm [options] [SERVICE...]
Options:
-s, --stop Stop the containers, if required, before removing
-v Remove any anonymous volumes attached to containers
There is no docker down
. The corresponding docker command is closer to: docker stop; docker rm
From docker-compose down:
Stops containers and removes containers, networks, volumes, and images created by up.
By default, the only things removed are:
- Containers for services defined in the Compose file
- Networks defined in the networks section of the Compose file
- The default network, if one is used
If docker-compose down
removes networks also, then by removing one container, it should also automatically disconnect the other containers from these networks, which might be undesirable or confusing.
It could change so that by default docker down
does not remove the networks, but that change might cause backwards-compatibility issues with the command.
This is just an assumption.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With