9.4.2.2 Down Network Removal
A focused guide to Down Network Removal, connecting core concepts with practical Docker and container operations.
Down network removal is the part of docker compose down's overall behavior responsible for removing any networks Compose created for the application — both the automatic default network and any explicitly declared custom networks — as part of the application's teardown.
How Networks Are Removed During Down
Once every service container has been stopped and removed, Compose removes the networks it created specifically for this application.
docker compose down
Removing network myapp_default
This network, automatically created when the application was first brought up, is removed as part of this teardown.
Why Networks Created by Compose Are Safe to Remove
Since these networks exist specifically to support this particular Compose application's services, removing them as part of a full teardown doesn't risk affecting anything outside this application's own scope.
docker network ls
Confirming the network no longer appears validates this part of the teardown completed successfully.
Why External Networks Are Never Removed by Down
A network referenced with external: true is understood to be managed outside this Compose file's scope, and down correctly leaves it untouched, regardless of how thorough the rest of the teardown is.
networks:
shared-net:
external: true
docker compose down
docker network ls
This external network remains present after down, since Compose never considered itself responsible for its lifecycle.
Recreating Networks on the Next Up
Since networks Compose created are fully removed by down, a subsequent up simply recreates them fresh, with no lingering state carried over from before.
docker compose up -d
Why Down Network Removal Matters
This network cleanup ensures a Compose application's teardown is genuinely complete, leaving no orphaned networking infrastructure behind, while correctly respecting the boundary around externally managed networks that don't belong to this application's own lifecycle.