Unverified Commit a9441adf authored by Kevin Klopfenstein's avatar Kevin Klopfenstein Committed by GitHub

Add docker-in-docker azure_dns_override flag (#200)

* Add docker-in-docker azure_dns_overrideflag

* Update install.sh

* clarify variable name

* update option name and description for `azureDnsAutoDetection`

* bump feature version
Co-authored-by: 's avatarJosh Spicer <josh@joshspicer.com>
parent 82960fd1
{ {
"id": "docker-in-docker", "id": "docker-in-docker",
"version": "1.0.4", "version": "1.0.5",
"name": "Docker (Docker-in-Docker)", "name": "Docker (Docker-in-Docker)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/docker-in-docker", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/docker-in-docker",
"description": "Create child containers *inside* a container, independent from the host's docker instance. Installs Docker extension in the container along with needed CLIs.", "description": "Create child containers *inside* a container, independent from the host's docker instance. Installs Docker extension in the container along with needed CLIs.",
...@@ -28,6 +28,11 @@ ...@@ -28,6 +28,11 @@
], ],
"default": "v1", "default": "v1",
"description": "Default version of Docker Compose (v1 or v2)" "description": "Default version of Docker Compose (v1 or v2)"
},
"azureDnsAutoDetection": {
"type": "boolean",
"default": true,
"description": "Allow automatically setting the dockerd DNS server when the installation script detects it is running in Azure"
} }
}, },
"entrypoint": "/usr/local/share/docker-init.sh", "entrypoint": "/usr/local/share/docker-init.sh",
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
DOCKER_VERSION=${VERSION:-"latest"} # The Docker/Moby Engine + CLI should match in version DOCKER_VERSION=${VERSION:-"latest"} # The Docker/Moby Engine + CLI should match in version
USE_MOBY=${MOBY:-"true"} USE_MOBY=${MOBY:-"true"}
DOCKER_DASH_COMPOSE_VERSION=${DOCKERDASHCOMPOSEVERSION:-"v1"} # v1 or v2 DOCKER_DASH_COMPOSE_VERSION=${DOCKERDASHCOMPOSEVERSION:-"v1"} # v1 or v2
AZURE_DNS_AUTO_DETECTION=${AZUREDNSAUTODETECTION:-"true"}
ENABLE_NONROOT_DOCKER=${ENABLE_NONROOT_DOCKER:-"true"} ENABLE_NONROOT_DOCKER=${ENABLE_NONROOT_DOCKER:-"true"}
USERNAME=${USERNAME:-"automatic"} USERNAME=${USERNAME:-"automatic"}
...@@ -312,7 +313,7 @@ if [ "${ENABLE_NONROOT_DOCKER}" = "true" ]; then ...@@ -312,7 +313,7 @@ if [ "${ENABLE_NONROOT_DOCKER}" = "true" ]; then
fi fi
tee /usr/local/share/docker-init.sh > /dev/null \ tee /usr/local/share/docker-init.sh > /dev/null \
<< 'EOF' << EOF
#!/bin/sh #!/bin/sh
#------------------------------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved. # Copyright (c) Microsoft Corporation. All rights reserved.
...@@ -321,6 +322,11 @@ tee /usr/local/share/docker-init.sh > /dev/null \ ...@@ -321,6 +322,11 @@ tee /usr/local/share/docker-init.sh > /dev/null \
set -e set -e
AZURE_DNS_AUTO_DETECTION=$AZURE_DNS_AUTO_DETECTION
EOF
tee -a /usr/local/share/docker-init.sh > /dev/null \
<< 'EOF'
dockerd_start="$(cat << 'INNEREOF' dockerd_start="$(cat << 'INNEREOF'
# explicitly remove dockerd and containerd PID file to ensure that it can start properly if it was stopped uncleanly # explicitly remove dockerd and containerd PID file to ensure that it can start properly if it was stopped uncleanly
# ie: docker kill <ID> # ie: docker kill <ID>
...@@ -360,7 +366,7 @@ dockerd_start="$(cat << 'INNEREOF' ...@@ -360,7 +366,7 @@ dockerd_start="$(cat << 'INNEREOF'
# Handle DNS # Handle DNS
set +e set +e
cat /etc/resolv.conf | grep -i 'internal.cloudapp.net' cat /etc/resolv.conf | grep -i 'internal.cloudapp.net'
if [ $? -eq 0 ] if [ $? -eq 0 ] && [ ${AZURE_DNS_AUTO_DETECTION} = "true" ]
then then
echo "Setting dockerd Azure DNS." echo "Setting dockerd Azure DNS."
CUSTOMDNS="--dns 168.63.129.16" CUSTOMDNS="--dns 168.63.129.16"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment