#!/usr/bin/env bash set -euo pipefail APP_DATA_DIR="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/..)/data" DOCKER_DIR="${APP_DATA_DIR}/docker" # Remove stale Docker-in-Docker runtime state that can survive power loss, # crashes, restarts, or updates and prevent the nested Docker daemon from # starting. # # Keep ${DOCKER_DIR}/data intact. It is the nested Docker graph root and may # contain user-managed Portainer containers, images, volumes, and stacks. rm -f "${DOCKER_DIR}/docker.pid" rm -f "${DOCKER_DIR}/docker.sock" rm -rf "${DOCKER_DIR}/exec"