mirror of
https://github.com/casjaysdevdocker/claude
synced 2026-06-24 14:01:02 -04:00
9114c4098d
Migrate claude Docker image to the new build-time config architecture. - rootfs/root/docker/setup/03-files.sh: rewrite to canonical form with /tmp/bin, /tmp/var, /tmp/etc, /tmp/usr handlers - rootfs/usr/local/etc/docker/functions/entrypoint.sh: update to latest template - rootfs/usr/local/etc/docker/init.d/*.sh: fix $(basename) UUOC; move inline comments above code lines - rootfs/tmp/etc/: add service config files (claude ) deployed to /etc/ at build time - rootfs/usr/local/share/template-files/: delete; config now deployed via /tmp/etc/ and /tmp/usr/ at build time rootfs/root/docker/setup/03-files.sh rootfs/tmp/ rootfs/usr/local/etc/docker/functions/entrypoint.sh rootfs/usr/local/etc/docker/init.d/01-dockerd.sh rootfs/usr/local/etc/docker/init.d/99-claude.sh rootfs/usr/local/share/template-files/config/claude/settings.json rootfs/usr/local/share/template-files/config/env/default.sample rootfs/usr/local/share/template-files/config/env/examples/00-directory.sh rootfs/usr/local/share/template-files/config/env/examples/addresses.sh rootfs/usr/local/share/template-files/config/env/examples/certbot.sh rootfs/usr/local/share/template-files/config/env/examples/couchdb.sh rootfs/usr/local/share/template-files/config/env/examples/dockerd.sh rootfs/usr/local/share/template-files/config/env/examples/global.sh rootfs/usr/local/share/template-files/config/env/examples/healthcheck.sh rootfs/usr/local/share/template-files/config/env/examples/mariadb.sh rootfs/usr/local/share/template-files/config/env/examples/mongodb.sh rootfs/usr/local/share/template-files/config/env/examples/networking.sh rootfs/usr/local/share/template-files/config/env/examples/other.sh rootfs/usr/local/share/template-files/config/env/examples/php.sh rootfs/usr/local/share/template-files/config/env/examples/postgres.sh rootfs/usr/local/share/template-files/config/env/examples/redis.sh rootfs/usr/local/share/template-files/config/env/examples/services.sh rootfs/usr/local/share/template-files/config/env/examples/ssl.sh rootfs/usr/local/share/template-files/config/env/examples/supabase.sh rootfs/usr/local/share/template-files/config/env/examples/webservers.sh rootfs/usr/local/share/template-files/config/env/examples/zz-entrypoint.sh rootfs/usr/local/share/template-files/config/.gitkeep rootfs/usr/local/share/template-files/data/.gitkeep rootfs/usr/local/share/template-files/defaults/.gitkeep
87 lines
3.1 KiB
Bash
Executable File
87 lines
3.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# shellcheck shell=bash
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
##@Version : 202601221300-git
|
|
# @@Author : CasjaysDev
|
|
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
|
# @@License : MIT
|
|
# @@Copyright : Copyright 2026 CasjaysDev
|
|
# @@Created : Wed Jan 22 01:00:00 PM EST 2026
|
|
# @@File : 01-dockerd.sh
|
|
# @@Description : Init script to start Docker daemon (optional)
|
|
# @@Changelog : newScript
|
|
# @@TODO : Better documentation
|
|
# @@Other :
|
|
# @@Resource :
|
|
# @@Terminal App : no
|
|
# @@sudo/root : yes
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
SCRIPT_NAME="${0##*/}"
|
|
SCRIPT_PID_FILE="/run/init.d/$SCRIPT_NAME.pid"
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Set env/config variables
|
|
DOCKER_SOCKET="${DOCKER_SOCKET:-}"
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Check if Docker socket is already available from host
|
|
if [ -S "/var/run/docker.sock" ]; then
|
|
# Check if it's actually writable (not just mounted)
|
|
if docker info >/dev/null 2>&1; then
|
|
echo "Using existing Docker daemon from host socket"
|
|
exit 0
|
|
fi
|
|
fi
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Ensure we're running with proper privileges for DinD
|
|
if [ ! -w "/var/run" ]; then
|
|
echo "ERROR: Cannot start Docker-in-Docker daemon - insufficient privileges"
|
|
echo "This container requires --privileged flag for full Docker-in-Docker support"
|
|
echo "Example: docker run --privileged ..."
|
|
exit 1
|
|
fi
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Create required directories for Docker
|
|
mkdir -p /var/lib/docker 2>/dev/null || true
|
|
mkdir -p /var/run 2>/dev/null || true
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Check if Docker daemon is already running
|
|
if [ -f "/var/run/docker.pid" ]; then
|
|
pid=$(cat /var/run/docker.pid)
|
|
if kill -0 "$pid" 2>/dev/null; then
|
|
echo "Docker daemon is already running (PID: $pid)"
|
|
exit 0
|
|
fi
|
|
fi
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Write PID file
|
|
echo $$ >"$SCRIPT_PID_FILE"
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Start Docker daemon in DinD mode
|
|
echo "Starting Docker-in-Docker (DinD) daemon..."
|
|
echo "Full Docker environment initializing..."
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Start dockerd in the background
|
|
dockerd \
|
|
--host=unix:///var/run/docker.sock \
|
|
--storage-driver=vfs \
|
|
>/data/logs/dockerd.log 2>&1 &
|
|
|
|
DOCKERD_PID=$!
|
|
echo "$DOCKERD_PID" > /var/run/docker.pid
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Wait for Docker daemon to be ready
|
|
echo "Waiting for Docker daemon to be ready..."
|
|
for i in {1..30}; do
|
|
if docker info >/dev/null 2>&1; then
|
|
echo "Docker daemon is ready (PID: $DOCKERD_PID)"
|
|
exit 0
|
|
fi
|
|
sleep 1
|
|
done
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
echo "ERROR: Docker daemon failed to start within 30 seconds"
|
|
exit 1
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# ex: ts=2 sw=2 et filetype=sh
|