Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

compose Up fails trying to recreate containers when not needed #494

Open
lucacome opened this issue Sep 18, 2017 · 6 comments · May be fixed by #504
Open

compose Up fails trying to recreate containers when not needed #494

lucacome opened this issue Sep 18, 2017 · 6 comments · May be fixed by #504

Comments

@lucacome
Copy link

I can't seem to find a way to replicate the behavior of docker-compose up -d, where if the container has not changed, nothing happens. Instead, I get:
ERRO[0006] Failed to start: rethinkdb : Error response from daemon: endpoint with name rethinkdb already exists in network ubuntu_default

Am I doing something wrong?

@lucacome
Copy link
Author

I'm guessing it's because of this set to true: https://github.com/docker/libcompose/blob/master/docker/service/service.go#L242

@vito-c
Copy link
Contributor

vito-c commented Sep 28, 2017

I can confirm this was introduced by this commit:
f5c34b0

@vito-c
Copy link
Contributor

vito-c commented Sep 29, 2017

@xihan88

@vito-c
Copy link
Contributor

vito-c commented Sep 29, 2017

Simple Expected Example with docker compose:

---
version: '2'
services:
    test.svr:
        container_name: test.svr
        image: alpine:latest
        command: sleep 10000
$ docker-compose up -d
Creating network "foo_default" with the default driver
Creating test.svr ...
Creating test.svr ... done
$ docker-compose up -d
test.svr is up-to-date

Then make a change to the compose file ports ["8080:8080"] for example

$ docker-compose up -d
Recreating test.svr ...
Recreating test.svr ... done

Libcompose is no longer following this behavior it is now barfing out an error on second up.

@lucacome
Copy link
Author

Is anything happening about this?

@xihan88
Copy link
Contributor

xihan88 commented Jan 24, 2018

@lucacome This issue is due to the problem from L331-L347 in this file

c, err = s.recreateIfNeeded(ctx, c, options.NoRecreate, options.ForceRecreate)
because if a container is not recreated, it shouldn't be connecting to the previous network and starting again. I will make a simple fix for it.
@vito-c In the previous version before my PR, a service will always be recreated (because of hashing an array of addresses) hence this issue won't show itself. I'm glad it brings out this important bug.

@xihan88 xihan88 linked a pull request Jan 24, 2018 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants