Skip to content

Instantly share code, notes, and snippets.

@nathanleclaire
Created April 12, 2019 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanleclaire/49d259cecd5e7cdd10c7943746bd01dd to your computer and use it in GitHub Desktop.
Save nathanleclaire/49d259cecd5e7cdd10c7943746bd01dd to your computer and use it in GitHub Desktop.

create a new network

$ docker network create test

create a container to listen

$ docker run -d --net test --network-alias listener alpine nc -l 8080

create another container to ping it

$ docker run -ti --net test alpine ping listener
PING listener3 (172.20.0.5): 56 data bytes
64 bytes from 172.20.0.5: seq=0 ttl=64 time=0.114 ms
64 bytes from 172.20.0.5: seq=1 ttl=64 time=0.198 ms
^C
--- listener3 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.114/0.156/0.198 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment