dlite
dlite copied to clipboard
Containers on their own network cannot be resolved (docker-compose conf v2)
Bug Reports
- dlite version in use (run
dlite --version
): 2.0.0-beta8 - expected behavior: with routing and DNS enabled I would expect to be able to resolve a container started by docker-compose as
.docker - actual behavior: I'm unable to resolve
- steps to reproduce
echo '
version: "2"
services:
test:
image: alpine
container_name: routetest1
command: sleep 60
' | docker-compose -f - up -d
ping routetest1.docker
But, if I use version 1 of the configuration-format, docker-compose won't set up a network for the service and everything now works
echo '
test:
image: alpine
container_name: routetest2
command: sleep 60
' | docker-compose -f - up -d
ping routetest2.docker
Two quick workarounds
1: Add network_mode: bridge to each of your docker-compose services eg
echo '
version: "2"
services:
test:
image: alpine
container_name: routetest3
network_mode: bridge
command: sleep 60
' | docker-compose -f - up -d
ping routetest3.docker
As this moves the container onto the "default" network, any services that needs to communicate with the service has to have the option added as well (this probably means all of your services)
2:
Add the container to the network after it has started, notice that this has to happen before any lookups are made
docker network connect bridge <container name>