

New scenario: Sharing a network between services 🔗 $ docker exec -it compose2_service2_1 ping compose1_service1_1 $ docker exec -it compose2_service2_1 ping service1 Test: Service 2 ping Service 1 🔗 # By service name $ docker exec -it compose1_service1_1 ping compose2_service2_1 $ docker exec -it compose1_service1_1 ping service2 Test: From Service 1 ping Service 2 🔗 # By service name $ pwdĬreating network "compose2_default" with the default driverĪ side-effect of these isolated networks are that the containers are unable to ping one another by service name or container name. A new default network is created and used. Starting services in a second docker compose file, we see the same behavior. Second docker compose file 🔗 version : '3' $ pwdĬreating network "compose1_default" with the default driver Its name is based on the service name and the directory name of the docker-compose.yml file.

When it starts up, a default network is created. Default scenario: Two separate docker-compose.yml and two separate default networks 🔗 The desired result was to be able to define a docker-compose.yml in one file, and in a second docker-compose.yml have the ability to reach the first service via service or container name for development purposes. This scenario came from a question I was asked docker-compose and network connectivity between services defined in different docker-compose.yml files. How to link multiple docker-compose services via network
