Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
fix: only log entrypoint when running the base arcane command
Kyle Mendelle95093f2ad90
diff --git a/scripts/docker/entrypoint.sh b/scripts/docker/entrypoint.shindex 173f2fc80..948483fb1 100644--- a/scripts/docker/entrypoint.sh+++ b/scripts/docker/entrypoint.sh@@ -6,7 +6,24 @@ if [ "$(id -u)" -ne 0 ]; thenexec "$@"fi-echo "Entrypoint: Setting up user and permissions..."+# Check if running a CLI subcommand (anything other than bare "arcane" or "/app/arcane")+QUIET_MODE=false+case "$1" in+ */arcane|arcane)+ # Check if there's a second argument (subcommand)+ if [ -n "$2" ] && [ "$2" != "" ]; then+ QUIET_MODE=true+ fi+ ;;+esac++log_entrypoint() {+ if [ "$QUIET_MODE" = "false" ]; then+ echo "$@"+ fi+}++log_entrypoint "Entrypoint: Setting up user and permissions..."PUID=${PUID:-2000}PGID=${PGID:-2000}@@ -16,17 +33,17 @@ APP_GROUP="arcane"DATA_DIR="/app/data"PROJECTS_DIR="${PROJECTS_DIR:-$DATA_DIR/projects}"-echo "Entrypoint: Using PUID=${PUID}, PGID=${PGID}, DOCKER_GID=${DOCKER_GID}"+log_entrypoint "Entrypoint: Using PUID=${PUID}, PGID=${PGID}, DOCKER_GID=${DOCKER_GID}"# Create or update the arcane groupif getent group "$PGID" >/dev/null 2>&1; thenEXISTING_GROUP=$(getent group "$PGID" | cut -d: -f1)if [ "$EXISTING_GROUP" != "$APP_GROUP" ]; then- echo "Entrypoint: Group with GID ${PGID} exists as '${EXISTING_GROUP}', using it..."+ log_entrypoint "Entrypoint: Group with GID ${PGID} exists as '${EXISTING_GROUP}', using it..."APP_GROUP="$EXISTING_GROUP"fielse- echo "Entrypoint: Creating group ${APP_GROUP} with GID ${PGID}..."+ log_entrypoint "Entrypoint: Creating group ${APP_GROUP} with GID ${PGID}..."addgroup -g "$PGID" "$APP_GROUP"fi@@ -34,33 +51,33 @@ fiif getent passwd "$PUID" >/dev/null 2>&1; thenEXISTING_USER=$(getent passwd "$PUID" | cut -d: -f1)if [ "$EXISTING_USER" != "$APP_USER" ] && [ "$EXISTING_USER" != "root" ]; then- echo "Entrypoint: Renaming user ${EXISTING_USER} to ${APP_USER}..."+ log_entrypoint "Entrypoint: Renaming user ${EXISTING_USER} to ${APP_USER}..."usermod -l "$APP_USER" -g "$PGID" "$EXISTING_USER" 2>/dev/null || trueelif [ "$EXISTING_USER" = "$APP_USER" ]; then- echo "Entrypoint: User ${APP_USER} already exists with UID ${PUID}"+ log_entrypoint "Entrypoint: User ${APP_USER} already exists with UID ${PUID}"usermod -g "$PGID" "$APP_USER" 2>/dev/null || truefielse- echo "Entrypoint: Creating user ${APP_USER} with UID ${PUID}..."+ log_entrypoint "Entrypoint: Creating user ${APP_USER} with UID ${PUID}..."adduser -D -u "$PUID" -G "$APP_GROUP" "$APP_USER"fi# Handle Docker socket and group# Skip socket configuration if using TCP proxy (DOCKER_HOST with tcp://)if [ -n "$DOCKER_HOST" ] && echo "$DOCKER_HOST" | grep -q "^tcp://"; then- echo "Entrypoint: Docker proxy mode detected (DOCKER_HOST=${DOCKER_HOST}), skipping socket setup"+ log_entrypoint "Entrypoint: Docker proxy mode detected (DOCKER_HOST=${DOCKER_HOST}), skipping socket setup"elif [ -S /var/run/docker.sock ]; thenSOCKET_GID=$(stat -c '%g' /var/run/docker.sock)- echo "Entrypoint: Docker socket found with GID ${SOCKET_GID}"+ log_entrypoint "Entrypoint: Docker socket found with GID ${SOCKET_GID}"if [ "$SOCKET_GID" = "0" ]; then- echo "Entrypoint: Docker socket owned by root group (GID 0), adding ${APP_USER} to root group..."+ log_entrypoint "Entrypoint: Docker socket owned by root group (GID 0), adding ${APP_USER} to root group..."addgroup "$APP_USER" root- echo "Entrypoint: Docker socket configured (using root group)"+ log_entrypoint "Entrypoint: Docker socket configured (using root group)"elseif getent group docker >/dev/null 2>&1; thenCURRENT_DOCKER_GID=$(getent group docker | cut -d: -f3)if [ "$CURRENT_DOCKER_GID" != "$SOCKET_GID" ]; then- echo "Entrypoint: Updating docker group GID from ${CURRENT_DOCKER_GID} to ${SOCKET_GID}..."+ log_entrypoint "Entrypoint: Updating docker group GID from ${CURRENT_DOCKER_GID} to ${SOCKET_GID}..."groupmod -g "$SOCKET_GID" docker 2>/dev/null || {delgroup docker 2>/dev/null || trueaddgroup -g "$SOCKET_GID" docker@@ -68,34 +85,34 @@ elif [ -S /var/run/docker.sock ]; thenfi# Ensure user is in docker groupif ! id -nG "$APP_USER" | grep -qw "docker"; then- echo "Entrypoint: Adding ${APP_USER} to docker group..."+ log_entrypoint "Entrypoint: Adding ${APP_USER} to docker group..."addgroup "$APP_USER" dockerfielse# Check if SOCKET_GID is already in use by another groupif getent group "$SOCKET_GID" >/dev/null 2>&1; thenEXISTING_GROUP=$(getent group "$SOCKET_GID" | cut -d: -f1)- echo "Entrypoint: GID ${SOCKET_GID} already used by group '${EXISTING_GROUP}'"+ log_entrypoint "Entrypoint: GID ${SOCKET_GID} already used by group '${EXISTING_GROUP}'"if [ "$EXISTING_GROUP" != "docker" ]; then- echo "Entrypoint: Adding ${APP_USER} to ${EXISTING_GROUP} for Docker socket access..."+ log_entrypoint "Entrypoint: Adding ${APP_USER} to ${EXISTING_GROUP} for Docker socket access..."addgroup "$APP_USER" "$EXISTING_GROUP"fielse- echo "Entrypoint: Creating docker group with GID ${SOCKET_GID}..."+ log_entrypoint "Entrypoint: Creating docker group with GID ${SOCKET_GID}..."addgroup -g "$SOCKET_GID" docker# Add user to newly created docker groupif ! id -nG "$APP_USER" | grep -qw "docker"; then- echo "Entrypoint: Adding ${APP_USER} to docker group..."+ log_entrypoint "Entrypoint: Adding ${APP_USER} to docker group..."addgroup "$APP_USER" dockerfififi- echo "Entrypoint: Docker socket configured (GID: ${SOCKET_GID})"+ log_entrypoint "Entrypoint: Docker socket configured (GID: ${SOCKET_GID})"fielseecho "WARNING: Docker socket not found at /var/run/docker.sock"if ! getent group docker >/dev/null 2>&1; then- echo "Entrypoint: Creating docker group with default GID ${DOCKER_GID}..."+ log_entrypoint "Entrypoint: Creating docker group with default GID ${DOCKER_GID}..."addgroup -g "$DOCKER_GID" dockeraddgroup "$APP_USER" dockerfi@@ -114,13 +131,13 @@ is_mountpoint() {[ -n "$dev_self" ] && [ -n "$dev_parent" ] && [ "$dev_self" != "$dev_parent" ]}-echo "Entrypoint: Setting up data directory..."+log_entrypoint "Entrypoint: Setting up data directory..."mkdir -p "$DATA_DIR"# If projects dir exists and is a separate mount, do not chown it recursively.SKIP_PROJECTS_CHOWN=falseif [ -d "$PROJECTS_DIR" ] && is_mountpoint "$PROJECTS_DIR"; then- echo "Entrypoint: Detected bind-mounted projects at $PROJECTS_DIR; skipping recursive chown"+ log_entrypoint "Entrypoint: Detected bind-mounted projects at $PROJECTS_DIR; skipping recursive chown"SKIP_PROJECTS_CHOWN=truefi@@ -151,17 +168,17 @@ if [ -d "$PROJECTS_DIR" ]; thenPRJ_UID="$(stat -c '%u' "$PRJ_PATH" 2>/dev/null || echo "")"PRJ_GID="$(stat -c '%g' "$PRJ_PATH" 2>/dev/null || echo "")"- echo "Entrypoint: Projects path used for GID detection: $PRJ_PATH (uid:$PRJ_UID gid:$PRJ_GID)"+ log_entrypoint "Entrypoint: Projects path used for GID detection: $PRJ_PATH (uid:$PRJ_UID gid:$PRJ_GID)"if [ -n "$PRJ_GID" ]; thenif getent group "$PRJ_GID" >/dev/null 2>&1; thenHOST_GROUP=$(getent group "$PRJ_GID" | cut -d: -f1)elseHOST_GROUP="hostgid_${PRJ_GID}"- echo "Entrypoint: Creating group ${HOST_GROUP} with GID ${PRJ_GID} for projects access"+ log_entrypoint "Entrypoint: Creating group ${HOST_GROUP} with GID ${PRJ_GID} for projects access"addgroup -g "$PRJ_GID" "$HOST_GROUP"fiif ! id -nG "$APP_USER" | grep -qw "$HOST_GROUP"; then- echo "Entrypoint: Adding ${APP_USER} to ${HOST_GROUP} (GID ${PRJ_GID})"+ log_entrypoint "Entrypoint: Adding ${APP_USER} to ${HOST_GROUP} (GID ${PRJ_GID})"addgroup "$APP_USER" "$HOST_GROUP"fi@@ -185,5 +202,5 @@ chown "${PUID}:${PGID}" /app# Favor group-writable files created by the appumask 002-echo "Entrypoint: Setup complete. Starting as ${APP_USER} (UID: ${PUID}, GID: ${PGID})"+log_entrypoint "Entrypoint: Setup complete. Starting as ${APP_USER} (UID: ${PUID}, GID: ${PGID})"exec su-exec "$APP_USER" "$@"