HUB
Sign inSign up

sbx/docker-agent-sessions:latest

Multi-platform
Manifest digest

sha256:a5d0106a238737c6ea77c16e4645f5f8fac2c4218a5939b32b728c71df3aa4c4

Last pushed

about 5 hours by dhibot

Type

Sandbox Kit

Manifest digest

sha256:a5d0106a238737c6ea77c16e4645f5f8fac2c4218a5939b32b728c71df3aa4c4

yaml
schemaVersion: "3"
displayName: Docker Agent host sessions
author: Docker, Inc. https://docker.com
description: Retain Docker Agent session database 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:
    - docker-agent
capabilities:
    - type: com.docker.sandbox/host-mount@1
      config:
        mode: "0700"
        path: /home/agent/docker-agent-history
    - type: com.docker.sandbox/lifecycle@1
      config:
        install:
            - command: |
                set -eu
                case "${SANDBOX_NAME:-}" in
                  "" | . | .. | */*) echo 'SANDBOX_NAME must be one path segment' >&2; exit 1 ;;
                esac
                state=/home/agent/.cagent
                history="/home/agent/docker-agent-history/$SANDBOX_NAME"
                mkdir -p "$state" "$history"
                for name in session.db session.db-wal session.db-shm; do
                  link="$state/$name"
                  target="$history/$name"
                  if [ -L "$link" ]; then
                    [ "$(readlink "$link")" = "$target" ] || { echo "Refusing unexpected symlink: $link" >&2; exit 1; }
                    continue
                  fi
                  if [ -e "$link" ]; then
                    echo "Cannot replace $link; move existing state to the host directory first." >&2
                    exit 1
                  fi
                  ln -s "$target" "$link"
                done
              description: Link the session database and SQLite sidecars to a per-sandbox host directory
              env:
                - SANDBOX_NAME
              user: agent
args:
    version:
        required: true
        buildArg: VERSION