sha256:31566c69fb474b36071d94d9ed74b9c53523e1f41cd6b68975b351265122bf55
Last pushed
7 days by dhibot
Type
Sandbox Kit
Manifest digest
sha256:31566c69fb474b36071d94d9ed74b9c53523e1f41cd6b68975b351265122bf55
schemaVersion: "3"
displayName: Claude host sessions
author: Docker, Inc. https://docker.com
description: Retain Claude session state on the host across sandbox removal
sourceUrl: https://github.com/docker-hardened-images/definitions
version: 1.0.0
licenses:
- Apache-2.0
kind: mixin
requires:
- claude
capabilities:
- type: com.docker.sandbox/host-mount@1
config:
mode: "0700"
path: /home/agent/claude-history
- type: com.docker.sandbox/lifecycle@1
config:
install:
- command: |
set -eu
state="/home/agent/.claude"
history="/home/agent/claude-history"
mkdir -p "$state"
for name in projects sessions todos shell-snapshots statsig; do
link="$state/$name"
target="$history/$name"
mkdir -p "$target"
if [ -L "$link" ]; then
if [ "$(readlink "$link")" != "$target" ]; then
printf 'Refusing to replace unexpected symlink: %s\n' "$link" >&2
exit 1
fi
continue
fi
# rmdir preserves existing sessions and refuses mounted volumes.
if [ -e "$link" ]; then
if ! rmdir "$link"; then
printf 'Cannot replace %s; move existing state to the host directory first.\n' "$link" >&2
exit 1
fi
fi
ln -s "$target" "$link"
done
description: Link Claude session state to the host-shared directory
user: agent
args:
version:
required: true
description: Revision of the session-linking hook
pattern: ^[0-9]+\.[0-9]+\.[0-9]+$
buildArg: VERSION