aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Klopfenstein <kklopfenstein@users.noreply.github.com>2022-10-06 18:29:22 +0300
committerKevin Klopfenstein <kklopfenstein@users.noreply.github.com>2022-10-06 18:41:01 +0300
commitc2628cefb123de087ec4305d714452600cbe2baf (patch)
tree2c1f2105244be00245a01214e74c40706f555408
parent82960fd16b04fb4003a8765b2381bd23553737b5 (diff)
Add docker-in-docker azure_dns_overrideflag
-rw-r--r--src/docker-in-docker/devcontainer-feature.json5
-rwxr-xr-xsrc/docker-in-docker/install.sh9
2 files changed, 12 insertions, 2 deletions
diff --git a/src/docker-in-docker/devcontainer-feature.json b/src/docker-in-docker/devcontainer-feature.json
index ea8a6df..aa6e5df 100644
--- a/src/docker-in-docker/devcontainer-feature.json
+++ b/src/docker-in-docker/devcontainer-feature.json
@@ -28,6 +28,11 @@
],
"default": "v1",
"description": "Default version of Docker Compose (v1 or v2)"
+ },
+ "azureDnsOverride": {
+ "type": "boolean",
+ "default": true,
+ "description": "Override docker daemon DNS settings to use Azure DNS"
}
},
"entrypoint": "/usr/local/share/docker-init.sh",
diff --git a/src/docker-in-docker/install.sh b/src/docker-in-docker/install.sh
index a67aaba..02e5ddd 100755
--- a/src/docker-in-docker/install.sh
+++ b/src/docker-in-docker/install.sh
@@ -11,6 +11,7 @@
DOCKER_VERSION=${VERSION:-"latest"} # The Docker/Moby Engine + CLI should match in version
USE_MOBY=${MOBY:-"true"}
DOCKER_DASH_COMPOSE_VERSION=${DOCKERDASHCOMPOSEVERSION:-"v1"} # v1 or v2
+AZURE_DNS_OVERRIDE=${AZUREDNSOVERRIDE:-"true"}
ENABLE_NONROOT_DOCKER=${ENABLE_NONROOT_DOCKER:-"true"}
USERNAME=${USERNAME:-"automatic"}
@@ -312,7 +313,7 @@ if [ "${ENABLE_NONROOT_DOCKER}" = "true" ]; then
fi
tee /usr/local/share/docker-init.sh > /dev/null \
-<< 'EOF'
+<< EOF
#!/bin/sh
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -321,6 +322,10 @@ tee /usr/local/share/docker-init.sh > /dev/null \
set -e
+AZURE_DNS_OVERRIDE=$AZURE_DNS_OVERRIDE
+EOF
+
+tee -a ./docker-init.sh > /dev/null << 'EOF'
dockerd_start="$(cat << 'INNEREOF'
# explicitly remove dockerd and containerd PID file to ensure that it can start properly if it was stopped uncleanly
# ie: docker kill <ID>
@@ -360,7 +365,7 @@ dockerd_start="$(cat << 'INNEREOF'
# Handle DNS
set +e
cat /etc/resolv.conf | grep -i 'internal.cloudapp.net'
- if [ $? -eq 0 ]
+ if [ $? -eq 0 ] && [ ${AZURE_DNS_OVERRIDE} = "true" ]
then
echo "Setting dockerd Azure DNS."
CUSTOMDNS="--dns 168.63.129.16"