Skip to content

Commit 0071d9a

Browse files
authored
Merge pull request #1542 from buildkite/SUP-4213-configurable-docker-address-pools
Allow Docker default address pools to be changed
2 parents fedab68 + 378343f commit 0071d9a

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

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

Lines changed: 7 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_IPV4_ADDRESS_POOL_1:-172.17.0.0/12}" \
61+
--arg pool2 "${DOCKER_IPV4_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,10 @@ 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_IPV4_ADDRESS_POOL_1:-172.17.0.0/12}" \
72+
--arg pool2 "${DOCKER_IPV4_ADDRESS_POOL_2:-192.168.0.0/16}" \
73+
--arg pool6 "${DOCKER_IPV6_ADDRESS_POOL:-2001:db8:2::/104}" \
74+
'.ipv6=true | ."fixed-cidr-v6"="2001:db8:1::/64" | .ip6tables=true | ."default-address-pools"=[{"base":$pool1,"size":20},{"base":$pool2,"size":24},{"base":$pool6,"size":112}]' \
7075
/etc/docker/daemon.json
7176
)" >/etc/docker/daemon.json
7277
else

templates/aws-stack.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,21 @@ Parameters:
597597
- "dualstack"
598598
Default: "ipv4"
599599

600+
DockerIPv4AddressPool1:
601+
Type: String
602+
Description: Primary IPv4 CIDR block for Docker default address pools. Must not conflict with host network or VPC CIDR. Only applies to Linux instances, not Windows.
603+
Default: "172.17.0.0/12"
604+
605+
DockerIPv4AddressPool2:
606+
Type: String
607+
Description: Secondary IPv4 CIDR block for Docker default address pools. Only applies to Linux instances, not Windows.
608+
Default: "192.168.0.0/16"
609+
610+
DockerIPv6AddressPool:
611+
Type: String
612+
Description: IPv6 CIDR block for Docker default address pools in dualstack mode. Only applies to Linux instances, not Windows.
613+
Default: "2001:db8:2::/104"
614+
600615
EnableSecretsPlugin:
601616
Type: String
602617
Description: Enables s3-secrets plugin for all pipelines
@@ -1581,6 +1596,9 @@ Resources:
15811596
DOCKER_USERNS_REMAP=${EnableDockerUserNamespaceRemap} \
15821597
DOCKER_EXPERIMENTAL=${EnableDockerExperimental} \
15831598
DOCKER_NETWORKING_PROTOCOL=${DockerNetworkingProtocol} \
1599+
DOCKER_IPV4_ADDRESS_POOL_1=${DockerIPv4AddressPool1} \
1600+
DOCKER_IPV4_ADDRESS_POOL_2=${DockerIPv4AddressPool2} \
1601+
DOCKER_IPV6_ADDRESS_POOL=${DockerIPv6AddressPool} \
15841602
BUILDKITE_ENABLE_INSTANCE_STORAGE="${EnableInstanceStorage}" \
15851603
/usr/local/bin/bk-configure-docker.sh
15861604
--==BOUNDARY==

0 commit comments

Comments
 (0)