diff --git a/docker-compose.yaml b/docker-compose.yaml index d2ca830..97b3ea8 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -13,7 +13,6 @@ services: - ./init.d:/init.d - ./workspace:/workspace - ./root:/root - - /var/run/user/1000/docker.sock:/run/docker.sock ports: - 58333:8443 - 58322:22 diff --git a/init.d/init.sh b/init.d/init.sh index 77bd329..69ee772 100755 --- a/init.d/init.sh +++ b/init.d/init.sh @@ -30,6 +30,7 @@ addpath /command export PATH /usr/sbin/sshd -D & +dockerd & # Wait for the Docker readiness notification, if any @@ -37,7 +38,6 @@ if read _ 2>/dev/null <&3 ; then exec 3<&- fi - # Now we're good: s6-overlay-suexec is accessible via PATH, as are # all our binaries. # Run preinit as root, then run stage0 as the container's user (can be diff --git a/init.d/run.sh b/init.d/run.sh index 8069c24..80235d8 100755 --- a/init.d/run.sh +++ b/init.d/run.sh @@ -3,7 +3,7 @@ set -euo pipefail apt update -apt install -y openssh-server vim ca-certificates curl gnupg +apt install -y openssh-server vim ca-certificates curl gnupg iputils-ping # Configure system-wide proxy for this container. PROXY_URL="http://10.8.0.1:7890" @@ -26,14 +26,8 @@ fi # Install Docker CLI only (docker-ce-cli) from official Docker repo. install -m 0755 -d /etc/apt/keyrings -curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc -chmod a+r /etc/apt/keyrings/docker.asc -ARCH="$(dpkg --print-architecture)" -. /etc/os-release -echo "deb [arch=${ARCH} signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu ${VERSION_CODENAME} stable" \ - >/etc/apt/sources.list.d/docker.list -apt update -apt install -y docker-ce-cli +export DOWNLOAD_URL="https://mirrors.tuna.tsinghua.edu.cn/docker-ce" +curl -fsSL https://raw.githubusercontent.com/docker/docker-install/master/install.sh | sh mkdir -p /run/sshd @@ -54,4 +48,5 @@ if [[ -f "${SCRIPT_DIR}/authorized_keys" ]]; then install -m 600 "${SCRIPT_DIR}/authorized_keys" /root/.ssh/authorized_keys fi +# Copy init.sh to /init cp /init.d/init.sh /init \ No newline at end of file