-
-
Notifications
You must be signed in to change notification settings - Fork 113
Description
Description
When an environment variable is converted to a secret via the Dockhand UI, the value is encrypted and stored in Dockhand's SQLite database (stack_environment_variables table with is_secret=1). This works correctly for Dockhand-initiated operations (deploy, stop, restart via the UI).
However, when Docker itself restarts a container — via restart: unless-stopped after a crash or host reboot — Docker Compose resolves ${VAR} references from the .env file on disk, which doesn't exist (or doesn't contain the secret). The container starts with empty environment variables and crash-loops.
This is a critical issue because restart: unless-stopped is the standard way to ensure containers survive reboots, and it's completely broken for any stack with Dockhand-managed secrets.
Related to #371 which fixed the Dockhand-side operations, but this is a different code path — Docker's own restart mechanism bypasses Dockhand entirely.
Steps to reproduce
- Deploy a stack with an environment variable referenced in
compose.yaml(e.g.,TUNNEL_TOKEN=${TUNNEL_TOKEN}) - In the Dockhand UI, click the button to convert that variable to a secret
- Verify the stack works when deployed through Dockhand
- Simulate a crash:
docker stop <container>— Docker's restart policy brings it back, but the env var is now empty - Alternatively, reboot the host — same result
Logs
# Container is in a restart loop
$ docker ps -a --filter name=cloudflared
NAMES STATUS IMAGE
cloudflared Restarting (255) 37 seconds ago cloudflare/cloudflared:latest
# Env var is empty
$ docker inspect cloudflared --format '{{json .Config.Env}}'
["TZ=Europe/London","TUNNEL_TOKEN=","PATH=..."]
# The value exists in Dockhand's DB, encrypted
$ sqlite3 /opt/data/dockhand/db/dockhand.db \
"SELECT key, is_secret FROM stack_environment_variables WHERE stack_name='cloudflared'"
TUNNEL_TOKEN|1Browser logs
N/A — this is a backend/Docker-level issue, not a UI issue.
Please confirm the following
- I have already searched for relevant existing issues and discussions before opening this report.
- I have updated the title field above with a concise description.