Skip to content
This repository has been archived by the owner on Feb 10, 2022. It is now read-only.

Commit

Permalink
Merge pull request #131 from cloudfoundry-incubator/bridge-network-sync
Browse files Browse the repository at this point in the history
Fixes  Bridge Network sync problem.
Great job y'all! You rock! Never have I seen such an exemplary pull request. You should take the rest of the day off and have a party. Seriously!
  • Loading branch information
pgoodwin authored Mar 25, 2019
2 parents bdf0439 + 5eddb3d commit 5fdb3fd
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions jobs/docker/templates/bin/ctl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@ source /var/vcap/packages/bosh-helpers/ctl_setup.sh 'docker'
export DOCKER_PID_FILE=${DOCKER_PID_DIR}/docker.pid
export PATH="/var/vcap/packages/docker/bin:$PATH"

function remove_docker_network_db(){
rm -f /var/vcap/data/docker/docker/network/files/local-kv.db
}

function create_network_bridge(){
if [ -n "${DOCKER_BRIDGE_NAME:-}" ]; then
set +e
ip link delete docker0
ip link delete ${DOCKER_BRIDGE_NAME}
/var/vcap/packages/docker/sbin/brctl addbr ${DOCKER_BRIDGE_NAME}
ip addr add ${DOCKER_BRIDGE_CIDR} dev ${DOCKER_BRIDGE_NAME}
ip link set dev ${DOCKER_BRIDGE_NAME} up
set -e
fi
}

case $1 in

start)
Expand All @@ -34,16 +50,8 @@ case $1 in
# Setup ssh env vars
${JOB_DIR}/bin/setup-user-env

# Create network bridge
if [ -n "${DOCKER_BRIDGE_NAME:-}" ]; then
set +e
ip link delete docker0
ip link delete ${DOCKER_BRIDGE_NAME}
/var/vcap/packages/docker/sbin/brctl addbr ${DOCKER_BRIDGE_NAME}
ip addr add ${DOCKER_BRIDGE_CIDR} dev ${DOCKER_BRIDGE_NAME}
ip link set dev ${DOCKER_BRIDGE_NAME} up
set -e
fi
create_network_bridge
remove_docker_network_db

# Enable shared_mounts
[ "${DOCKER_SHARED_MOUNTS_ENABLE}" = "true" ] && mount --make-shared /
Expand Down

0 comments on commit 5fdb3fd

Please sign in to comment.