-
Notifications
You must be signed in to change notification settings - Fork 84
Open
Description
A documentation type deployment of caddy which runs as root with docker-compose (https://hub.docker.com/_/caddy) works with auto-ssl flawlessly.
If a docker deployment has the flag user set to 1000:1000 and a named volume is used instead of a local path the user permissions stay root. If a deployment has just user set to 1000:1000 but still uses local paths, the created directories will still have root permissions.
The only solution is to manually chown -R 1000:1000 either the docker volume _data/ directory or the local path.
Sample docker-compose.yaml
version: "3.9"
services:
caddy:
image: caddy:2-alpine
restart: unless-stopped
user: 1000:1000 # <--- the culprit
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- $PWD/../Caddyfile:/etc/caddy/Caddyfile
- $PWD/site:/srv v
- caddy_data:/data
- caddy_config:/config
- ./caddy_data:/data
- ./caddy_config:/config
volumes:
caddy_data:
caddy_config:
Unfortunately the below Dockerfile didn't help either.
ENV UID 1000
ENV GID 1000
RUN addgroup -g $GID -S caddy ; adduser -SDHs /sbin/nologin -u $UID -G caddy caddy ; chown $UID:$GID /data ; chown $UID:$GID /config
VOLUME /data
VOLUME /config
RUN chown -R $UID:$GID /data /config
The result is the same either way unless i manually chown -R it with the respective user and group id:
{"level":"error","ts":1680045963.1747446,"logger":"tls","msg":"job failed","error":"domain.tld: obtaining certificate: failed storage check: open /data/caddy/rw_test_4836700798867844449: permission denied - storage is probably misconfigured"}
{"level":"error","ts":1680045963.1751785,"logger":"tls","msg":"job failed","error":"domain.tld: obtaining certificate: failed storage check: open /data/caddy/rw_test_148537797091318011: permission denied - storage is probably misconfigured"}
{"level":"error","ts":1680045963.1753407,"msg":"unable to autosave config","file":"/config/caddy/autosave.json","error":"open /config/caddy/autosave.json: permission denied"}
{"level":"info","ts":1680045963.1753864,"msg":"serving initial configuration"}
papukj, bcat, rugk and jinndi
Metadata
Metadata
Assignees
Labels
No labels