Skip to content

Docker entrypoint fails on non-root runtimes (ECS Fargate, Bottlerocket, etc.)#32005

Open
goingforstudying-ctrl wants to merge 16 commits into
hashicorp:mainfrom
goingforstudying-ctrl:fix/docker-entrypoint-mlock
Open

Docker entrypoint fails on non-root runtimes (ECS Fargate, Bottlerocket, etc.)#32005
goingforstudying-ctrl wants to merge 16 commits into
hashicorp:mainfrom
goingforstudying-ctrl:fix/docker-entrypoint-mlock

Conversation

@goingforstudying-ctrl

Copy link
Copy Markdown

Docker entrypoint fails on non-root runtimes (ECS Fargate, Bottlerocket, etc.)

After the Dockerfile switched to USER vault in 2.0.0, the entrypoint still tries to run setcap and chown unconditionally. On runtimes that don't grant IPC_LOCK or where the container starts as a non-root user, setcap fails with EPERM and the container exits before vault ever runs.

I hit this on an ECS Fargate task — the only workaround was setting SKIP_SETCAP=true, but that still leaves the entrypoint printing confusing warnings and doesn't handle the case where someone explicitly disabled mlock via VAULT_DISABLE_MLOCK.

The fix adds an explicit non-root branch to both entrypoint scripts:

  • scripts/docker/docker-entrypoint.sh — used by the main Docker build
  • .release/docker/ubi-docker-entrypoint.sh — used by the Red Hat UBI build

What changes:

  • When id -u != 0, we skip the setcap/chown block entirely instead of failing
  • We still print the SKIP_SETCAP / SKIP_CHOWN warnings so operators know what's happening
  • We respect VAULT_DISABLE_MLOCK so users who explicitly disabled mlock don't get spurious errors
  • The root path is unchanged: it still runs setcap, chown, and drops to the vault user via su-exec

I also added a small Go test under scripts/docker/ that syntax-checks both entrypoint scripts and verifies the non-root guard is present. It's not a full integration test, but it catches accidental regressions in the shell logic.

Fixes #31919

@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

Deployment failed with the following error:

The `vercel.json` schema validation failed with the following message: should NOT have additional property `public`

Learn More: https://vercel.com/docs/concepts/projects/project-configuration

@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vault-ui Error Error Jul 17, 2026 8:06am

Request Review

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Used to indicate a potential bug docker labels Jun 20, 2026
@goingforstudying-ctrl
goingforstudying-ctrl force-pushed the fix/docker-entrypoint-mlock branch from 501733a to 3c1b390 Compare June 22, 2026 02:32
@goingforstudying-ctrl
goingforstudying-ctrl force-pushed the fix/docker-entrypoint-mlock branch 2 times, most recently from 7452de7 to 4b3655c Compare June 22, 2026 19:06
@goingforstudying-ctrl
goingforstudying-ctrl force-pushed the fix/docker-entrypoint-mlock branch from 4b3655c to 20493f3 Compare June 22, 2026 21:39
@goingforstudying-ctrl
goingforstudying-ctrl force-pushed the fix/docker-entrypoint-mlock branch from d0b5e33 to 25d63c6 Compare June 24, 2026 00:42
@goingforstudying-ctrl
goingforstudying-ctrl force-pushed the fix/docker-entrypoint-mlock branch from 25d63c6 to f5e459b Compare June 24, 2026 17:06
@goingforstudying-ctrl
goingforstudying-ctrl force-pushed the fix/docker-entrypoint-mlock branch from f5e459b to 0792da7 Compare June 24, 2026 18:38
@goingforstudying-ctrl
goingforstudying-ctrl force-pushed the fix/docker-entrypoint-mlock branch from 0792da7 to 4f5374f Compare June 24, 2026 22:02
docker_entrypoint_test.go was missing the IBM copyright header.
changelog/32005.txt documents the non-root runtime entrypoint fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Used to indicate a potential bug docker size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vault 2.0.0 Docker image fails to start: unable to set CAP_SETFCAP effective capability

1 participant