Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

dockerComposeTest does not clean up custom networks #55

Closed
Tillaert opened this issue Apr 16, 2017 · 4 comments
Closed

dockerComposeTest does not clean up custom networks #55

Tillaert opened this issue Apr 16, 2017 · 4 comments

Comments

@Tillaert
Copy link
Contributor

Given a docker compose file:

version: "2.1"

services:
  mongonode:
    image: mongo
    networks:
      - mongodb

networks:
  mongodb:

After running dockerComposeTest:

Going to remove 245930_mongonode_1
Error response from daemon: network 245930_default not found

And docker network ls shows:

8b286c100378        295810_mongodb      bridge              local

It seems that dockerComposeTest uses docker-compose stop to stop the containers. docker-compose down will clean up resources properly.

@Tillaert
Copy link
Contributor Author

Tillaert commented Apr 17, 2017

Quick question: Why is the plugin tyring to keep track of the running instances and stopping them? It seems that the plugin is reimplementing docker-compose functionality. Is it because the containers/networks should remain afterwards?

@kurtkopchik
Copy link
Contributor

Hi @Tillaert,

Thanks for reporting this issue! docker-compose down was not being used because this plugin was created before that command was available. In order to maintain compatibility with older versions and allow for some of the advanced debugging flags in the Plugin to continue to work such as composeRemoveContainersOnShutdown I'm attempting to stick with docker-compose stop for now. However, in the future I may switch over to using docker-compose down instead.

I have released a 1.0.21-SNAPSHOT version with PR #58 which should contain the functionality that you are looking for. It is similar to the PR you made except that it also prevents external networks from being removed, verifies that the network is in use before removing it, and also attempts to check for the default network.

Let me know if it works for you and I'll merge it into master.

resolvers += "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
addSbtPlugin("com.tapad" % "sbt-docker-compose" % "1.0.21-SNAPSHOT")

@Tillaert
Copy link
Contributor Author

The current 1.0.21-SNAPSHOT indeed cleans up the networks 👍

@kurtkopchik
Copy link
Contributor

Closing this issue out as there is now an official release that includes this update:

addSbtPlugin("com.tapad" % "sbt-docker-compose" % "1.0.21")

@Tillaert - Thanks again for your assistance.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants