Permission denied when using bind mounts with rootless Docker and non-1000 UID #6807
|
When running Woodpecker CI in rootless Docker with a bind mount for My theory is that:
This creates a permission mismatch, causing Woodpecker to fail with error:
services:
woodpecker-server:
image: woodpeckerci/woodpecker-server:v3.16-alpine
restart: unless-stopped
user: "1004:1004"
volumes:
- ./docker:/var/lib/woodpecker
environment:
- WOODPECKER_HOST=${WOODPECKER_HOST}
- WOODPECKER_ADMIN=${WOODPECKER_ADMIN}
- WOODPECKER_GITEA=true
- WOODPECKER_GITEA_URL=${WOODPECKER_GITEA_URL}
- WOODPECKER_GITEA_CLIENT=${WOODPECKER_GITEA_CLIENT}
- WOODPECKER_GITEA_SECRET=${WOODPECKER_GITEA_SECRET}
- WOODPECKER_AGENT_SECRET=${WOODPECKER_AGENT_SECRET}
- WOODPECKER_PLUGINS_PRIVILEGED=${WOODPECKER_PLUGINS_PRIVILEGED}Environment:
I also tested the following unsuccessfully:
Is there a recommended way to run Woodpecker in rootless Docker with non-1000 UIDs? |
Replies: 2 comments
|
I moved woodpecker to the 1000:1000 user, but I got still the same error, because it seems that the files are mounted using
By changing |
|
That result matches the rootless Docker UID mapping behavior. In rootless mode, container That also matches the Woodpecker image layout: the rootless server image creates The practical options are: volumes:
- woodpecker-server-data:/var/lib/woodpecker
volumes:
woodpecker-server-data:or, if you need to keep the bind mount: user: "0:0"
volumes:
- /your/host/path:/var/lib/woodpeckerIn rootless Docker, I would avoid So the cleanest fix is the named volume. The bind-mount fix is to run as |
That result matches the rootless Docker UID mapping behavior.
In rootless mode, container
rootis not host root: the daemon and containers run inside the rootless user's user namespace. For bind mounts, files owned by the host user can appear as owned byrootinside the container. So if the Woodpecker process runs as container UID1000, it may not be able to write a bind-mounted directory even when the host path is owned by your host UID1004.That also matches the Woodpecker image layout: the rootless server image creates
/var/lib/woodpeckerfor thewoodpeckeruser (1000:1000), while the documented compose example uses a Docker named volume for/var/lib/woodpecker, where the rootless dae…