-
Notifications
You must be signed in to change notification settings - Fork 36
Implement docker-compose down [--volumes]
#82
Comments
The plugin was created before One thing I did like about As for the particular issue with named volumes it would also probably be pretty easy to add some code that gets the set of named volumes and explicitly removes them using |
Hi @ches, so that you are not affected by the current I haven't extensively tested it but released a
|
Thanks a lot for doing this @kurtkopchik, I could have taken a stab at it but you beat me to it. Just getting back to it after a few days but I'm using the snapshot now and it's working well so far. |
Hi @ches - Happy to help! This change is now included in an official release:
|
The plugin currently implements the
dockerComposeStop
command, which ultimately runsdocker-compose stop
, but it also deletes the stopped containers, their anonymous volumes, and the network for the Compose project instance (composition?) according tocomposeRemoveContainersOnShutdown
andcomposeRemoveNetworkOnShutdown
settings which default to true.This essentially matches the semantics of
docker-compose down
, rather thandocker-compose stop
which leaves the resources around to be started back up again (one might intuitively expectdockerComposeRestart
to do that).I feel that a dedicated
dockerComposeDown
command would be less surprising for users with knowledge of Docker Compose, changingdockerComposeStop
to not remove containers/network. IMO the two settings mentioned above should then go away entirely.This would also open the way to resolve a current shortcoming: named volumes are never deleted. I have real-world Compose configs using those—see #81. The current implementation deletes the containers with:
That only deletes anonymous volumes. This would remove named ones as well:
Without this, sbt-docker-compose will leave my CI agents with tons of orphaned Docker volumes over time if builds reference Compose configs containing named volumes.
Changing
dockerComposeStop
behavior would be backwards-incompatible, but to me the improved parity withdocker-compose
and named volume cleanup would be a worthy part of a major version bump. We could introducedockerComposeDown
initially in a minor version without yet changingdockerComposeStop
or its settings, if desired.The text was updated successfully, but these errors were encountered: