Skip to content

Commit 0d4042f

Browse files
committed
Added docker startup script to avoid configuring container message to hang
1 parent 4da90a2 commit 0d4042f

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"build": {
44
"dockerfile": "./Dockerfile"
55
},
6-
"postStartCommand": "sudo rm /var/run/docker.pid; sudo dockerd",
76
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
7+
"postStartCommand": "bash .devcontainer/docker-startup.sh",
88
"hostRequirements": {
99
"cpus": 2,
1010
"memory": "8gb",

.devcontainer/docker-startup.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Check if dockerd is already running
5+
if ! pgrep -x dockerd > /dev/null; then
6+
echo "Starting Docker daemon..."
7+
sudo dockerd --log-level=error > /tmp/dockerd.log 2>&1 &
8+
sleep 2
9+
fi
10+
11+
# Wait for Docker to be ready
12+
until docker ps > /dev/null 2>&1; do
13+
echo "Waiting for Docker..."
14+
sleep 1
15+
done
16+
17+
echo "Docker is ready!"

0 commit comments

Comments
 (0)