- For single host networking Refer Here
- For docker swarm Refer Here
- For overlay & multihost networking Refer Here
- Docker networking follows a specification called as Container Network Model (CNM) Refer Here
- Docker has a opensource project called as libnetwork which is implementation of CNM
- Lets experiment with default bridge network
- Create two containers dc1 and dc2
docker container run --name dc1 -d alpine sleep 1d docker container run --name dc2 -d alpine sleep 1d
- Now lets login into dc1 and ping dc2
- Now lets find ip addresses of dc1 and dc2 . try pinging with ip address
- As per the observations we can ping from one container to other container using ip address in default bridge network
- Now lets create user defined bridge network
- Now lets inspect the created network
docker network inspect <network-name>
- Lets create two containers as shown above in user-defined network
- Now lets try to ping from one cotnainer to other
- User defined bridge networks have name based resolution enabled.
- Running applications on single host might lead to single point of failure, we need to run our containers on multiple machines and there should be connectivity.
- This is where we will be learning Docker multi-host networking (Overlay driver) and We will introduce Docker Swarm.