version : ' 2'
services :
bar :
image : alpine
command : sh -xc 'ping foo'
foo :
image : alpine
command : sh -xc 'ping bar'
docker/docker-compose のバージョン
docker: 1.12.1
docker-compose: 1.8.0 (pip で install)
$ docker version
Client:
Version: 1.12.1
API version: 1.24
Go version: go1.6.3
Git commit: 23cf638
Built: Thu Aug 18 05:02:53 2016
OS/Arch: linux/amd64
Server:
Version: 1.12.1
API version: 1.24
Go version: go1.6.3
Git commit: 23cf638
Built: Thu Aug 18 05:02:53 2016
OS/Arch: linux/amd64
$ docker-compose -v
docker-compose version 1.8.0, build 94f7016
$ docker-compose up
Recreating nameresolv_foo_1
Recreating nameresolv_bar_1
Attaching to nameresolv_foo_1, nameresolv_bar_1
foo_1 | + ping bar
bar_1 | + ping foo
bar_1 | PING foo (172.20.0.2): 56 data bytes
foo_1 | PING bar (172.20.0.3): 56 data bytes
bar_1 | 64 bytes from 172.20.0.2: seq=0 ttl=64 time=0.135 ms
foo_1 | 64 bytes from 172.20.0.3: seq=0 ttl=64 time=0.076 ms
foo_1 | 64 bytes from 172.20.0.3: seq=1 ttl=64 time=0.112 ms
bar_1 | 64 bytes from 172.20.0.2: seq=1 ttl=64 time=0.140 ms
bar_1 | 64 bytes from 172.20.0.2: seq=2 ttl=64 time=0.101 ms
foo_1 | 64 bytes from 172.20.0.3: seq=2 ttl=64 time=0.101 ms
foo_1 | 64 bytes from 172.20.0.3: seq=3 ttl=64 time=0.127 ms
bar_1 | 64 bytes from 172.20.0.2: seq=3 ttl=64 time=0.127 ms
bar_1 | 64 bytes from 172.20.0.2: seq=4 ttl=64 time=0.152 ms
foo_1 | 64 bytes from 172.20.0.3: seq=4 ttl=64 time=0.152 ms
foo_1 | 64 bytes from 172.20.0.3: seq=5 ttl=64 time=0.128 ms
bar_1 | 64 bytes from 172.20.0.2: seq=5 ttl=64 time=0.128 ms
foo_1 | 64 bytes from 172.20.0.3: seq=6 ttl=64 time=0.126 ms
bar_1 | 64 bytes from 172.20.0.2: seq=6 ttl=64 time=0.126 ms
foo_1 | 64 bytes from 172.20.0.3: seq=7 ttl=64 time=0.149 ms
bar_1 | 64 bytes from 172.20.0.2: seq=7 ttl=64 time=0.149 ms