two docker-compose .yml in the same network with COMPOSE_PROJECT_NAME
I am trying to have my own network name for my docker-compose files (server.yml and test.yml), as test.yml gets only started from time to time, but needs access to some services in the server.yml. I can make it work with docker-compose -p nameofproject up, but not with COMPOSE_PROJECT_NAME. server.yml version: '2' networks: mynetwork: driver: bridge services: app1: networks: - mynetwork environment: POSTGRES_PASSWORD: somepassword COMPOSE_PROJECT_NAME: serverstack app2: networks: - mynetwork environment: COMPOSE_PROJECT_NAME: serverstack depends_on: - app1 My expectation is that when the container is starting I should see Creating serverstackmynetwork_app_1 Creating serverstackmynetwork_app_2 the network should be named (docker network ls) serverstack_mynetwork just like when I do the following, which actually works docker-compose -p serverstack up And then I can connect just by using docker-compose up with the second file (which works just fine when using the -p option on the server.yml) testing.yml version: '2' networks: testapp_network: external: name: serverstack_mynetwork services: testapp: networks: - testapp_network But using it without -p serverstack on the server.yml I see directories as names Creating directoryofapp1_app1_1 Creating directoryofapp2_app2_1 so COMPOSE_PROJECT_NAME is being omitted and I also cannot connect to the server service though serverstack_mynetwork I did add the COMPOSE_PROJECT_NAME: serverstack after building the image, but I would expect it should work anyhow. What am I missing?
Defining project name inside docker-compose configuration
Docker-compose named mounted volume
cannot ping linked docker container service
How to do variable substitution in env_file?
How to create stack in tutum with docker-compose.yml file?
ecs-cli docker compose version
dynamic link update in docker-compose
How to start arbitrarily many identical containers with docker-compose?
How to stop docker-compose run command
Unable to run sensu check in a docker-compose context
Should I use docker-compose start or docker-compose up -d
Docker Compose automatically setting links
docker compose volumes not contains files
Inheritance or nesting with docker compose
Reading docker-compose environment variables in application code
Docker Compose wait for container X before starting Y