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

Containers on their own network cannot be resolved (docker-compose conf v2) #208

Open
danquah opened this issue Oct 29, 2016 · 1 comment
Labels
Milestone

Comments

@danquah
Copy link

danquah commented Oct 29, 2016

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

@danquah
Copy link
Author

danquah commented Oct 29, 2016

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>

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

No branches or pull requests

2 participants