How network works in docker-compose?
docker-compose
creates a set of containers, brings them up along with a private network. The network is very interesting because a private network is essential to compose & test a microservice bases system.
I found the post https://medium.com/@caysever/docker-compose-network-b86e424fad82 quite useful.
Post Highlights
docker-compose
creates a default network, if no network is specified.- The name of the network is
<local dir>_default
. - The default network type is
bridge
.
Bridge Network
A bridge is a layer 2 component. It understands segments and uses a hardware/software switch/bridge.
Host Network
Use the host network namespace. It is preferred for achieving high performance. It works on Linux only.