- When you start Docker, a default bridge network (also called bridge) is created automatically, and newly-started containers connect to it unless otherwise specified. This is OBSOLETED. Should use custom bridge network
- Containers on the default bridge network can only access each other by IP addresses, unless you use the --link option, which is considered legacy. On a user-defined bridge network, containers can resolve each other by name or alias.
docker network create local docker run -it --rm -v /mytmp:/mytmp --network local --name ansible ubuntu:hly nc -l 8080docker run -it --rm -v /mytmp:/mytmp --network local ubuntu:hly curl http://ansible:8080
- Create custom bridge network
- When launch container specify --network to attach to that bridge
- Containers in the same bridge have DNS resolve and freely to connect to each other