Skip to content

Changing Docker Default Bridge Network

This guide explains how to change the default Docker bridge network subnet.

When to Use This

Change the Docker bridge network when:

  • The default 172.17.0.0/16 subnet conflicts with your network
  • You need a specific subnet for Docker containers
  • Network routing issues occur due to subnet overlap

Steps

1. Create Docker Daemon Configuration

# Navigate to Docker config directory
cd /etc/docker

# Create daemon.json file
sudo nano daemon.json

2. Add Bridge Configuration

Add the following content to daemon.json:

{
  "bip": "172.1.1.1/24"
}

Replace 172.1.1.1/24 with your desired subnet.

3. Restart Docker

# Restart Docker service
sudo systemctl restart docker

Verification

# Check Docker bridge network
ip addr show docker0

# Verify new subnet is applied
docker network inspect bridge

Troubleshooting

Docker Fails to Start

Solutions: - Check JSON syntax in daemon.json - Ensure subnet doesn't conflict with existing networks - Review Docker logs: sudo journalctl -u docker

Existing Containers Can't Connect

Solutions: - Restart existing containers - Recreate containers to use new bridge network - Check container network settings


This guide applies to Docker on Linux systems.