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
Introduce project-name in docker-compose.yml file (fixes #745) #5369
Conversation
Signed-off-by: Alexey Merezhin <estarter@gmail.com>
Signed-off-by: Alexey Merezhin <estarter@gmail.com>
Signed-off-by: Alexey Merezhin <estarter@gmail.com>
check compose_name property for uniqueness Signed-off-by: Alexey Merezhin <estarter@gmail.com>
Should |
Hi @estarter ! First off, thank you for contributing this PR. Thank you for your understanding! |
Hi @shin- ! Thanks for the explanation. It's not an easy case for you guys to take deal with! It would be great if you could clarify maintainer's position on the question ( one , two ). Let me formulate it as brief as possible: ls PR_5378
# .env
# docker-compose.yml
# docker-compose2.yml
cat .env
# COMPOSE_X_PROJECT_NAME=1
COMPOSE_X_PROJECT_NAME=1 docker-compose -f PR_5378/docker-compose.yml -f PR_5378/docker-compose2.yml down
# => project name: myproj --- GOOD, perfect!
docker-compose -f PR_5378/docker-compose.yml -f PR_5378/docker-compose2.yml down
# => project name: pr5378 --- FAIL, How I can make it work?
cd PR_5378 && docker-compose -f docker-compose.yml -f docker-compose2.yml down
# => project name: myproj --- GOOD, perfect!
In #745 (comment) you mentioned Hope you'll find time for answer. Thanks! |
If we went ahead with adding |
Here's what i have for our main project. It's a maven project creating a zip file with our deliverables - it's ~2GB and corresponds to dozen of different docker images (servers, j2ee, flyway, standalone, ...). - docker-compose1.yml
- docker-compose2.yml
- docker-compose3.yml
+ docker
-- dbash
-- dbuild
-- ...
-+ images
--+ container1
---- Dockerfile
--+ container2
--+ container3
--+ containerN docker-composeX.xml file defines a logical slice of the system (could be dependent on docker-composeY.xml). in the docker folder there are docker helper scripts, you can guess the purpose from the name: With time these scripts become more advance, now it allows a developer to define the scope and works with it (e.g. I work with docker-compose1.yml and docker-compose3.yml ; docker-compose2.yml containers are not interested for me in my current work). Today we mostly using this scripts instead of docker / docker-compose commands for the common actions. Scripts are printing out the docker / docker-compose command for the convenience.
That's a good option for me. The issue is that the restriction to call docker-compose file from specific location (hidden conventions, which would result in frustration). BTW for P.S. Sorry for the long answer, hope you find anything useful here. |
Hi @shin- ! I was thinking hard about this issue and found another use-case from our real env that can be interesting for you - for the #745 itself and usage of We have some heavy proprietary server (let's call it
Here's the structure: docker-compose-srv.yml
# services:
# srv:
# build:
# context: docker/images/srv
# db_srv:
# build:
# context: docker/images/db_srv
# ....
docker-compose-srv_v1.yml
# services:
# db_srv:
# build:
# args:
# SRV_VERSION: 1
# srv:
# build:
# args:
# SRV_VERSION: 1
# ....
docker-compose-srv_v2.yml
# ....
docker-compose-srv_v3.yml
# ....
+ docker
-+ images
--+ srv
---- Dockerfile
# ARG SRV_VERSION
# FROM internal.docker.repo/srv:${SRV_VERSION}
# ...
--+ db_srv
---- Dockerfile
# ARG SRV_VERSION
# FROM internal.docker.repo/db_srv:${SRV_VERSION}
# ... To this structure it's kind of natural to have So I'm looking forward for the new docker-compose with #5378 merged! |
Added project_name property to the docker-compose.yml file.
Added new schemas with the property: 2.4 and 3.6
project_name property has a lowest prio (expect dir name - which is a default option):
Example of docker-compose.yml v.2:
Example of docker-compose.yml v.3: