Skip to content

Commit 10e5b40

Browse files
committed
Allow Docker default address pools to be changed
1 parent 4b0a0f8 commit 10e5b40

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

packer/linux/conf/bin/bk-configure-docker.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ if [[ "${DOCKER_NETWORKING_PROTOCOL}" == "ipv4" ]]; then
5757
# This is the default
5858
cat <<<"$(
5959
jq \
60-
'."default-address-pools"=[{"base":"172.17.0.0/12","size":20},{"base":"192.168.0.0/16","size":24}]' \
60+
--arg pool1 "${DOCKER_ADDRESS_POOL_1:-172.17.0.0/12}" \
61+
--arg pool2 "${DOCKER_ADDRESS_POOL_2:-192.168.0.0/16}" \
62+
'."default-address-pools"=[{"base":$pool1,"size":20},{"base":$pool2,"size":24}]' \
6163
/etc/docker/daemon.json
6264
)" >/etc/docker/daemon.json
6365
elif [[ "${DOCKER_NETWORKING_PROTOCOL}" == "dualstack" ]]; then
@@ -66,7 +68,9 @@ elif [[ "${DOCKER_NETWORKING_PROTOCOL}" == "dualstack" ]]; then
6668
DOCKER_EXPERIMENTAL=true
6769
cat <<<"$(
6870
jq \
69-
'.ipv6=true | ."fixed-cidr-v6"="2001:db8:1::/64" | .ip6tables=true | ."default-address-pools"=[{"base":"172.17.0.0/12","size":20},{"base":"192.168.0.0/16","size":24},{"base":"2001:db8:2::/104","size":112}]' \
71+
--arg pool1 "${DOCKER_ADDRESS_POOL_1:-172.17.0.0/12}" \
72+
--arg pool2 "${DOCKER_ADDRESS_POOL_2:-192.168.0.0/16}" \
73+
'.ipv6=true | ."fixed-cidr-v6"="2001:db8:1::/64" | .ip6tables=true | ."default-address-pools"=[{"base":$pool1,"size":20},{"base":$pool2,"size":24},{"base":"2001:db8:2::/104","size":112}]' \
7074
/etc/docker/daemon.json
7175
)" >/etc/docker/daemon.json
7276
else

templates/aws-stack.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,16 @@ Parameters:
587587
- "dualstack"
588588
Default: "ipv4"
589589

590+
DockerAddressPool1:
591+
Type: String
592+
Description: Primary CIDR block for Docker default address pools. Only applies to Linux instances, not Windows.
593+
Default: "172.17.0.0/12"
594+
595+
DockerAddressPool2:
596+
Type: String
597+
Description: Secondary CIDR block for Docker default address pools. Only applies to Linux instances, not Windows.
598+
Default: "192.168.0.0/16"
599+
590600
EnableSecretsPlugin:
591601
Type: String
592602
Description: Enables s3-secrets plugin for all pipelines
@@ -1571,6 +1581,8 @@ Resources:
15711581
DOCKER_USERNS_REMAP=${EnableDockerUserNamespaceRemap} \
15721582
DOCKER_EXPERIMENTAL=${EnableDockerExperimental} \
15731583
DOCKER_NETWORKING_PROTOCOL=${DockerNetworkingProtocol} \
1584+
DOCKER_ADDRESS_POOL_1=${DockerAddressPool1} \
1585+
DOCKER_ADDRESS_POOL_2=${DockerAddressPool2} \
15741586
BUILDKITE_ENABLE_INSTANCE_STORAGE="${EnableInstanceStorage}" \
15751587
/usr/local/bin/bk-configure-docker.sh
15761588
--==BOUNDARY==

0 commit comments

Comments
 (0)