7
7
# Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/docker-in-docker.md
8
8
# Maintainer: The VS Code and Codespaces Teams
9
9
#
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]
11
11
12
12
ENABLE_NONROOT_DOCKER=${1:- " true" }
13
13
USERNAME=${2:- " automatic" }
14
14
USE_MOBY=${3:- " true" }
15
15
DOCKER_VERSION=${4:- " latest" } # The Docker/Moby Engine + CLI should match in version
16
16
DOCKER_DASH_COMPOSE_VERSION=${5:- " v1" } # v1 or v2
17
+ AZURE_DNS_AUTO_DETECTION=${6:- " true" }
17
18
MICROSOFT_GPG_KEYS_URI=" https://packages.microsoft.com/keys/microsoft.asc"
18
19
DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES=" buster bullseye bionic focal jammy"
19
20
DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES=" buster bullseye bionic focal hirsute impish jammy"
@@ -316,7 +317,7 @@ if [ "${ENABLE_NONROOT_DOCKER}" = "true" ]; then
316
317
fi
317
318
318
319
tee /usr/local/share/docker-init.sh > /dev/null \
319
- << ' EOF '
320
+ << EOF
320
321
#!/bin/sh
321
322
#-------------------------------------------------------------------------------------------------------------
322
323
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -325,6 +326,11 @@ tee /usr/local/share/docker-init.sh > /dev/null \
325
326
326
327
set -e
327
328
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 '
328
334
dockerd_start="$(cat << 'INNEREOF'
329
335
# explicitly remove dockerd and containerd PID file to ensure that it can start properly if it was stopped uncleanly
330
336
# ie: docker kill <ID>
@@ -364,7 +370,7 @@ dockerd_start="$(cat << 'INNEREOF'
364
370
# Handle DNS
365
371
set +e
366
372
cat /etc/resolv.conf | grep -i 'internal.cloudapp.net'
367
- if [ $? -eq 0 ]
373
+ if [ $? -eq 0 ] && [ ${AZURE_DNS_AUTO_DETECTION} = "true" ]
368
374
then
369
375
echo "Setting dockerd Azure DNS."
370
376
CUSTOMDNS="--dns 168.63.129.16"
396
402
chmod +x /usr/local/share/docker-init.sh
397
403
chown ${USERNAME} :root /usr/local/share/docker-init.sh
398
404
399
- echo ' docker-in-docker-debian script has completed!'
405
+ echo ' docker-in-docker-debian script has completed!'
0 commit comments