26 lines
565 B
Bash
Executable File
26 lines
565 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
# Create required directories if they don't exist
|
|
mkdir -p /var/run/docker
|
|
|
|
# Start the Docker daemon in the background
|
|
dockerd &
|
|
|
|
# Wait until Docker is ready
|
|
timeout=60
|
|
until docker info >/dev/null 2>&1; do
|
|
if [ $timeout -le 0 ]; then
|
|
echo >&2 "❌ Docker daemon failed to start within expected time."
|
|
exit 1
|
|
fi
|
|
echo "⏳ Waiting for Docker to be ready... ($timeout)"
|
|
sleep 1
|
|
timeout=$((timeout - 1))
|
|
done
|
|
|
|
echo "✅ Docker daemon is up and running."
|
|
|
|
# Execute any passed command (default: bash)
|
|
exec "$@"
|