aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Spicer <joshspicer@github.com>2023-06-28 20:19:40 +0300
committerJosh Spicer <joshspicer@github.com>2023-06-28 20:19:40 +0300
commit72a0981209bd868f6a924729f8a6f35b00bcefce (patch)
treeb1e2c7eaf214a5274d682f05ffa9270a19b41269
parent1de0ff9f7773d598b4cdd7b09c7107293655c15c (diff)
wait for docker to be ready
-rwxr-xr-xsrc/docker-in-docker/install.sh16
-rw-r--r--test/docker-in-docker/javascript_node_major_version_1.sh11
-rw-r--r--test/docker-in-docker/scenarios.json16
3 files changed, 37 insertions, 6 deletions
diff --git a/src/docker-in-docker/install.sh b/src/docker-in-docker/install.sh
index e3b7990..1058cfb 100755
--- a/src/docker-in-docker/install.sh
+++ b/src/docker-in-docker/install.sh
@@ -385,7 +385,7 @@ dockerd_start="AZURE_DNS_AUTO_DETECTION=${AZURE_DNS_AUTO_DETECTION} DOCKER_DEFAU
# Handle DNS
set +e
- cat /etc/resolv.conf | grep -i 'internal.cloudAAAapp.net' > /dev/null 2>&1
+ cat /etc/resolv.conf | grep -i 'internal.cloudapp.net' > /dev/null 2>&1
if [ $? -eq 0 ] && [ "${AZURE_DNS_AUTO_DETECTION}" = "true" ]
then
CUSTOMDNS="--dns 168.63.129.16"
@@ -404,6 +404,20 @@ dockerd_start="AZURE_DNS_AUTO_DETECTION=${AZURE_DNS_AUTO_DETECTION} DOCKER_DEFAU
# Start docker/moby engine
( dockerd $CUSTOMDNS $DEFAULT_ADDRESS_POOL > /tmp/dockerd.log 2>&1 ) &
+
+ # Wait for API to be listening on unix socket.
+ echo "Waiting for 'docker-in-docker' to be ready..."
+ COUNTER=0
+ while ! (cat /tmp/dockerd.log | grep 'API listen on /var/run/docker.sock') > /dev/null 2>&1; do
+ sleep 1
+ COUNTER=$((COUNTER+1))
+ if [ $COUNTER -gt 5 ]
+ then
+ echo "(!) 'docker-in-docker' did not initialize correctly."
+ exit 1
+ fi
+ done
+
echo "'docker-in-docker' initialization complete."
INNEREOF
)"
diff --git a/test/docker-in-docker/javascript_node_major_version_1.sh b/test/docker-in-docker/javascript_node_major_version_1.sh
new file mode 100644
index 0000000..404b688
--- /dev/null
+++ b/test/docker-in-docker/javascript_node_major_version_1.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -e
+
+# Optional: Import test library
+source dev-container-features-test-lib
+
+./test.sh
+
+# Report result
+reportResults \ No newline at end of file
diff --git a/test/docker-in-docker/scenarios.json b/test/docker-in-docker/scenarios.json
index 9c44478..5da5067 100644
--- a/test/docker-in-docker/scenarios.json
+++ b/test/docker-in-docker/scenarios.json
@@ -50,23 +50,29 @@
},
"docker_build_older": {
"image": "mcr.microsoft.com/devcontainers/javascript-node:0-18",
+ "remoteUser": "node",
"features": {
"docker-in-docker": {
"version": "20",
"moby": "false",
"dockerDashComposeVersion": "v2"
}
- },
- "remoteUser": "node"
+ }
},
"docker_build_no_compose": {
"image": "mcr.microsoft.com/devcontainers/javascript-node:0-18",
+ "remoteUser": "node",
"features": {
"docker-in-docker": {
"dockerDashComposeVersion": "none"
}
- },
- "remoteUser": "node"
+ }
+ },
+ "javascript_node_major_version_1": {
+ "image": "mcr.microsoft.com/devcontainers/javascript-node:1-18",
+ "remoteUser": "node",
+ "features": {
+ "docker-in-docker": {}
+ }
}
-
}