Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save anshumania/9d6999ef3c35ca8502d91566ed636f40 to your computer and use it in GitHub Desktop.
Save anshumania/9d6999ef3c35ca8502d91566ed636f40 to your computer and use it in GitHub Desktop.
docker-compose problem
given
.
|-- docker-compose.yml
|-- node1
| `-- Dockerfile
|-- node2
| `-- Dockerfile
and Dockerfile as
FROM centos:centos6.6
docker-compose.yml
version: '2'
services:
dn1:
build: ./node1/.
hostname: dn1.foo.com
command: tail -f /dev/null
dn2:
build: ./node2/.
hostname: dn2.foo.com
command: tail -f /dev/null
then
docker-compose up -d
docker exec -it test_dn1 bash
$ hostname
dn1.foo.com
$ ping dn2.foo.com
PING dn2.foo.com (23.x.x.122)
$ ping dn1
64 bytes from test_dn2_1.test_default (172.21.0.3) ....
how to make dn1 resolve dn2 via its hostname dn2.foo.com ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment