Last active
July 9, 2020 12:36
-
-
Save etuttle/bc1cd3814b984ec694d6 to your computer and use it in GitHub Desktop.
Assigning a MAC to docker0 in /etc/sysconfig/docker. Hacky, fix for ancient docker ~1.6 issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/sysconfig/docker | |
# | |
# Other arguments to pass to the docker daemon process | |
# These will be parsed by the sysv initscript and appended | |
# to the arguments list passed to docker -d | |
other_args="--bridge=docker0" | |
DOCKER_CERT_PATH=/etc/docker | |
# Resolves: rhbz#1176302 (docker issue #407) | |
DOCKER_NOWARN_KERNEL_VERSION=1 | |
# Location used for temporary files, such as those created by | |
# # docker load and build operations. Default is /var/lib/docker/tmp | |
# # Can be overriden by setting the following environment variable. | |
# # DOCKER_TMPDIR=/var/tmp | |
# Work-around a linux bridging issue that can cause network interruptions as | |
# containers are started or stopped. | |
# | |
# This is a bit heavy-handed as it runs every time the docker init.d script | |
# runs. But it works, and it's an easy way to make sure docker0 is configured | |
# before docker is started. | |
# | |
# see https://github.com/docker/docker/issues/11407 | |
# see http://backreference.org/2010/07/28/linux-bridge-mac-addresses-and-dynamic-ports/ | |
( | |
exec > /dev/null | |
exec 2> /dev/null | |
brctl addbr docker0 || true | |
ip addr add 172.17.42.1/16 dev docker0 || true | |
# add a dummy interface to the bridge | |
ip link add dummy0 type dummy || true | |
brctl addif docker0 dummy0 || true | |
# set the bridge's MAC to match the enslaved dummy MAC | |
ip link set docker0 address $(cat /sys/class/net/dummy0/address) | |
ip link set dev docker0 up | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment