Skip to main content

Docker Success Center

The Docker enterprise customer portal.

Docker, Inc.

How do I configure the default bridge (docker0) network for Docker Engine to a different subnet?

The Docker Engine default bridge network is conflicting with our internal network hosts access. How do I configure the default bridge (docker0) network for Docker Engine to a different subnet?

You can configure the default bridge network by providing the --bip option along with the desired subnet using two possible methods:

  • Start the Docker daemon with the --bip option. For example:
    docker daemon --bip=172.26.0.1/16
  • Edit the Docker daemon configuration file to always use the --bip option during daemon startup. (Instructions below.)

Editing the Docker daemon configuration file on Ubuntu

For Ubuntu hosts, the Docker daemon configuration file can be found at /etc/default/docker. Uncomment the DOCKER_OPTS line and add the --bip option.

The daemon configuration file (/etc/default/docker) file should look something like this:


# Docker Upstart and SysVinit configuration file

#
# THIS FILE DOES NOT APPLY TO SYSTEMD
#
#   Please see the documentation for "systemd drop-ins":
#   https://docs.docker.com/engine/articles/systemd/
#

# Customize location of Docker binary (especially for development testing).
#DOCKERD="/usr/local/bin/dockerd"

# Use DOCKER_OPTS to modify the daemon startup options.
DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4 --bip=172.26.0.1/16"

# If you need Docker to use an HTTP proxy, it can also be specified here.
#export http_proxy="http://127.0.0.1:3128/"

# This is also a handy place to tweak where Docker's temporary files go
#export TMPDIR="/mnt/bigdrive/docker-tmp

Editing the Docker daemon configuration file on RHEL/CentOS 7.x

For RHEL 7.x and CentOS 7.x hosts, first, follow the documentation on this link to learn how to create the config file: https://docs.docker.com/engine/admin/#/configuring-docker-1.

The Docker daemon configuration file is located at /etc/systemd/system/docker.service.d/docker.conf.

The daemon configuration file should look something like this:


[Service]
ExecStart=
ExecStart=/usr/bin/docker daemon -H fd:// --bip=172.26.0.1/1

Please ensure that the IP address specified does not end with .0 (*.*.*.0) as these are reserved network addresses.

An example of a valid entry would be --bip=172.26.0.1/1.

For further information on configuring the default bridge network and the options available, refer to https://docs.docker.com/engine/userguide/networking/default_network/custom-docker0/.

  • Was this article helpful?