Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If a data only container starts with the same name than the active container, compose fails #1454

Closed
MBuffenoir opened this issue May 24, 2015 · 5 comments

Comments

@MBuffenoir
Copy link

Example docker-compose.yml:

dbdata:
  image: postgres:9.3
  command: echo "data only container (might already exists)"

db:
  image: postgres:9.3
  environment:
    DB_PASSWORD: postgres
    DB_USER: postgres
    DB_NAME: postgres
  ports:
    - "5432:5432"
  volumes_from: 
    - dbdata

Error raised is:
A service can not mount itself as volume

I believe the error is due to the usage of "in" here:
https://github.com/docker/compose/blob/master/compose/project.py#L38

@thaJeztah
Copy link
Member

Ah, interesting :)

@aanand I wonder if this can be tweaked as well, now that labels are used?

@kojiromike
Copy link

I couldn't reproduce this behavior with docker-compose 1.3.0 dev (889d363). I tried this simplified test case:

aa:
    image: busybox
    volumes:
        - /foo
    command: echo 'oof'
a:
    image: busybox
    volumes_from:
        - aa

And then I tried OP's original example. I tried with both up and run. I did not get an error in any of those four attempts.

@dnephin
Copy link

dnephin commented Jul 3, 2015

The "in" on that line means "in the list" not "not in the string".

If this is still an issue please feel free to re-open with an update config and the full output of the docker-compose command you ran.

@dnephin dnephin closed this as completed Jul 3, 2015
@richfletcher
Copy link

For the benefit of future searchers, this appears to be caused when a string is used as the value of volumes_from instead of a list. Then, the 'in' above checks for a substring of the given value for volumes_from.

Of course, a possible enhancement could be to either refuse a string or automatically listify it.

@dnephin
Copy link

dnephin commented Jul 31, 2015

Ah, this should be fixed by #129

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

No branches or pull requests

5 participants