Wednesday, 28 May 2025

Additoinal Docker Useful Info - bip, subnet, daemon

/etc/docker/dameon.json

https://docs.docker.com/engine/network/drivers/bridge/#:~:text=In%20terms%20of%20networking%2C%20a,user%2Ddefined%20custom%20bridge%20networks.

https://serverfault.com/questions/916941/configuring-docker-to-not-use-the-172-17-0-0-range#:~:text=The%20default%20bridge,networks%20in%20the%20wrong%20range.


 In Docker, bip in daemon.json refers to the "Bridge IP" addressIt specifies the IP address and subnet used by the Docker daemon's default bridge network, which is used for communication between the host and containers



by default, Docker uses a bridge networkWhen you start Docker, a default bridge network is automatically created, and new containers will connect to it unless you specify otherwise. This network, also known as the `docker0 bridge, provides basic networking functionality for containers. 



In Docker's daemon.json, both "bip" and "default-address-pools" are used to configure networking, but they serve different purposes. "bip" defines the IP address and subnet of the default bridge network, while "default-address-pools" specifies a pool of subnets for Docker to use when creating user-defined bridge networks. 


docker-compose.yml

https://docs.docker.com/engine/daemon/ipv6/#:~:text=2%20Accept:%20*/*-,Dynamic%20IPv6%20subnet%20allocation,IPv6%20pools%20of%20your%20own

The networks key in a docker-compose.yml file is used to define and assign custom networks to your Docker services. This allows you to manage and isolate communication between containers more effectively. 

https://mrkaran.dev/tils/docker-custom-subnet/

While Docker Compose allows defining subnets for networks within a Compose file, using default-address-pools in daemon.json provides a global configuration for Docker itself, impacting all networks, including those created by Compose when a subnet isn't explicitly definedThis ensures consistent subnet usage across all Docker environments, including those managed by Compose. 

https://serverfault.com/questions/916941/configuring-docker-to-not-use-the-172-17-0-0-range

docker-compose network subnets can be outside the default address pool defined in daemon.jsonDocker Compose allows you to specify a subnet for a network, and if that subnet is not within the address pools defined in daemon.json, it will still function, but it will be a custom network. 


If you define network and dont define a network in service, it will use a random IP inthe subnet, 


you can also define a specific network with IP in each service


No comments:

Post a Comment