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

2 docker-compose.yml, same directory name - causes 'mixing' of services #2120

Closed
roytruelove opened this issue Oct 1, 2015 · 2 comments
Closed

Comments

@roytruelove
Copy link

(docker-compose v1.4.2, docker v1.8.2, ubuntu trusty)

I was seeing situations where a command, while in one directory, would affect containers reference by the .yml in another directory. I realized that this occurs when the directories have the same name.

For instance, I've got this directory structure. Note that the root dirs for the projects are both called config

- A
     - config
          - docker-compose.yml
- B
     - config
          - docker-compose.yml

And the .yml files are the same except for the container name:

redis:
  image:  redis
  container_name: redis_container_(A or B)

If I start A then go to B and start that, B doesn't start, it recreates A. Here's the flow:

/tmp/dockerComposeTest/A/config$ docker-compose up -d
Creating redis_container_A...
/tmp/dockerComposeTest/A/config$ cd ../../B/config/
/tmp/dockerComposeTest/B/config$ docker-compose up -d
Recreating redis_container_A...                                                   # !!!
/tmp/dockerComposeTest/B/config$

I've seen this with stop, kill, etc.

This will NOT happen with the following dir structure, presumably because the root directory names are different.

- A
     - docker-compose.yml
- B
     - docker-compose.yml
@dnephin
Copy link

dnephin commented Oct 1, 2015

Right, the default project name is the name of the directory. You can customize it with -p or COMPOSE_PROJECT_NAME http://docs.docker.com/compose/reference/overview/#compose-project-name

#745 is a proposal for allow a persistent way to set the name

@dnephin dnephin closed this as completed Oct 19, 2015
@dnephin
Copy link

dnephin commented Oct 19, 2015

I'm going to add a note about this to the documentation as well.

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

No branches or pull requests

2 participants