My problem was a not quite the same; docker compose down postgres
did not work. I did not want to down everything. Solved with docker compose kill postgres
.
Your issue was the external network. From the Docker documentation on 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.
Networks and volumes defined as external are never removed.
Anonymous volumes are not removed by default. However, as they don’t have a stable name, they are not automatically mounted by a subsequent
up
. For data that needs to persist between updates, use explicit paths as bind mounts or named volumes.
Your docker-compose.yml is leeching on the existing network called stormy-network. It would be bad if docker compose down
removed a network belonging to a different project. From your description I'm guessing that you didn't actually have a network in another project that you wanted to connect to. Maybe you meant network mode host?