# Create a network
$ docker network create foo
24ec61d239758d698d07cbb13f1adb0616d2011495fbff911930f743bd9bfc23
# Create two containers (separate terminals)
$ docker run --rm -it --name c1 --net foo centos:7 bash
$ docker run --rm -it --name c2 --net foo centos:7 bash
# Ping
[root@08dbf9ce687f /]# ping c1
PING c1 (172.21.0.3) 56(84) bytes of data.
64 bytes from c1.foo (172.21.0.3): icmp_seq=1 ttl=64 time=0.118 ms
Created
May 11, 2016 15:05
-
-
Save csainty/668193bf19895f2a8d2b8ea17eef7dd0 to your computer and use it in GitHub Desktop.
Connect docker containers
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment