Forked from hgross/gist:26042d052f58feeb6d1b329e8dd2dfcc
Created
October 22, 2019 20:57
-
-
Save trapier/2b0e04590edd27e7544cb542a4737fd3 to your computer and use it in GitHub Desktop.
Change docker_gwbridge subnet address
This file contains 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
## Do this on each swarm-node | |
# store containers attached to the bridge | |
$ gwbridge_users=$(docker network inspect --format '{{range $key, $val := .Containers}} {{$key}}{{end}}' docker_gwbridge | \ | |
$ xargs -d' ' -I {} -n1 docker ps --format {{.Names}} -f id={}) | |
# stop all containers | |
# if you have stacks that restart automatically, remove them via docker stack <stackName> rm | |
$ echo "$gwbridge_users" | xargs docker stop | |
$ docker network rm docker_gwbridge | |
$ docker network disconnect -f docker_gwbridge gateway_ingress-sbox | |
$ docker network rm docker_gwbridge | |
$ SUBNET=172.20.0.0/20 | |
$ GATEWAY=172.20.0.1 | |
$ docker network create \ | |
--subnet=${SUBNET} \ | |
--gateway ${GATEWAY} \ | |
-o com.docker.network.bridge.enable_icc=false \ | |
-o com.docker.network.bridge.name=docker_gwbridge \ | |
docker_gwbridge | |
$ echo "$gwbridge_users" | xargs docker start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment