Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

Commit 5be0c5f

Browse files
Add docker-in-docker Azure DNS override flag (#1650)
* Add docker-in-docker Azure DNS override flag * Resolving PR feedback * change `AZURE_DNS_OVERRIDE` to a more descriptive name Co-authored-by: Josh Spicer <[email protected]>
1 parent d2d7419 commit 5be0c5f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

script-library/docker-in-docker-debian.sh

+10-4
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
# Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/docker-in-docker.md
88
# Maintainer: The VS Code and Codespaces Teams
99
#
10-
# Syntax: ./docker-in-docker-debian.sh [enable non-root docker access flag] [non-root user] [use moby] [Engine/CLI Version] [Major version for docker-compose]
10+
# Syntax: ./docker-in-docker-debian.sh [enable non-root docker access flag] [non-root user] [use moby] [Engine/CLI Version] [Major version for docker-compose] [azure DNS auto detection flag]
1111

1212
ENABLE_NONROOT_DOCKER=${1:-"true"}
1313
USERNAME=${2:-"automatic"}
1414
USE_MOBY=${3:-"true"}
1515
DOCKER_VERSION=${4:-"latest"} # The Docker/Moby Engine + CLI should match in version
1616
DOCKER_DASH_COMPOSE_VERSION=${5:-"v1"} # v1 or v2
17+
AZURE_DNS_AUTO_DETECTION=${6:-"true"}
1718
MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc"
1819
DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal jammy"
1920
DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal hirsute impish jammy"
@@ -316,7 +317,7 @@ if [ "${ENABLE_NONROOT_DOCKER}" = "true" ]; then
316317
fi
317318

318319
tee /usr/local/share/docker-init.sh > /dev/null \
319-
<< 'EOF'
320+
<< EOF
320321
#!/bin/sh
321322
#-------------------------------------------------------------------------------------------------------------
322323
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -325,6 +326,11 @@ tee /usr/local/share/docker-init.sh > /dev/null \
325326
326327
set -e
327328
329+
AZURE_DNS_AUTO_DETECTION=$AZURE_DNS_AUTO_DETECTION
330+
EOF
331+
332+
tee -a /usr/local/share/docker-init.sh > /dev/null \
333+
<< 'EOF'
328334
dockerd_start="$(cat << 'INNEREOF'
329335
# explicitly remove dockerd and containerd PID file to ensure that it can start properly if it was stopped uncleanly
330336
# ie: docker kill <ID>
@@ -364,7 +370,7 @@ dockerd_start="$(cat << 'INNEREOF'
364370
# Handle DNS
365371
set +e
366372
cat /etc/resolv.conf | grep -i 'internal.cloudapp.net'
367-
if [ $? -eq 0 ]
373+
if [ $? -eq 0 ] && [ ${AZURE_DNS_AUTO_DETECTION} = "true" ]
368374
then
369375
echo "Setting dockerd Azure DNS."
370376
CUSTOMDNS="--dns 168.63.129.16"
@@ -396,4 +402,4 @@ EOF
396402
chmod +x /usr/local/share/docker-init.sh
397403
chown ${USERNAME}:root /usr/local/share/docker-init.sh
398404

399-
echo 'docker-in-docker-debian script has completed!'
405+
echo 'docker-in-docker-debian script has completed!'

0 commit comments

Comments
 (0)