O'Reilly logo

Learning Docker Networking by Santosh Kumar Konduri, Vaibhav Kohli, Rajdeep Dua

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating containers using an overlay network

The following are the steps for creating containers using an overlay network:

  1. Create a container c0 on mhs-demo0 and connect to the my-net network:
    $ eval $(docker-machine env mhs-demo0)
    root@843b16be1ae1:/#
    
    $ sudo docker run -i -t --name=c0 --net=my-net  debian /bin/bash
    

    Execute ifconfig to find the IPaddress of c0. In this case, it is 10.0.0.4:

    root@843b16be1ae1:/# ifconfig
    eth0      Link encap:Ethernet  HWaddr 02:42:0a:00:00:04
              inet addr:10.0.0.4  Bcast:0.0.0.0  Mask:255.255.255.0
              inet6 addr: fe80::42:aff:fe00:4/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1450  Metric:1
              RX packets:17 errors:0 dropped:0 overruns:0 frame:0
              TX packets:17 errors:0 dropped:0 overruns:0 carrier:0
     collisions:0 txqueuelen:0 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required