Unable to write config files - permissions issue?

Hello,

I’m not overly experienced with docker (I mostly just run a few containers) and have thrown together a build for an open source project called Watcher: https://github.com/ellnic/Watcher3

Things were working well until recently, and I need some input to pin point what is going wrong now.

Symptoms: docker seems unable to write files to the /config folder. This happens whether specifying a user with either PUID / GUID or —user. The config folder on the host always seems to be created as root. I was under the impression that specifying the --user flag or PUID/PGID would alter this? However, the problem also occurs if running with privileges so I am unsure if that is the issue anyway. The config folder on the host is always created as root, but remains empty. The logs show Watcher spewing a ton of errors because it cannot create/access a db. I tried recently adding a user for the container to run the command, but this doesn’t seem to have helped.

Docker hub: ellnic/watcher3

OS: Ubuntu 18.04

Docker Version:

Client: Docker Engine - Community
 Version:           19.03.5
 API version:       1.40
 Go version:        go1.12.12
 Git commit:        633a0ea838
 Built:             Wed Nov 13 07:29:52 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.5
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.12
  Git commit:       633a0ea838
  Built:            Wed Nov 13 07:28:22 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.10
  GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
 runc:
  Version:          1.0.0-rc8+dev
  GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Docker file:

FROM alpine:3.8

ENV LANG="en_US.utf8" APP_NAME="watcher3" IMG_NAME="watcher3"

RUN apk add --no-cache bash curl git nano vim ca-certificates python3
RUN rm -rf /tmp/* /var/tmp/*

# Create a group and user
RUN addgroup -S watcher && adduser -S watcher -G watcher
# Tell docker that all future commands should run as the watcher user
USER watcher

COPY . /opt/$APP_NAME

WORKDIR /opt/watcher3

VOLUME /config
EXPOSE 9090

CMD python3 /opt/$APP_NAME/watcher.py -c /config/watcher.cfg -l /config/logs/ --db /config/db/database.sqlite --plugins /config/plugins/ --posters /config/posters

Example run command:

docker run --name=watcher3-test -v /mnt/Docker/docker-configs/watcher3-test:/config -v /mnt/Files:/Files --user $(id -u):$(id -g) -p 9292:9090 --restart unless-stopped ellnic/watcher3

or

docker run --name=watcher3-test -v /mnt/Docker/docker-configs/watcher3-test:/config -v /mnt/Files:/Files -e PUID=1000 -e PGID=1000 -p 9292:9090 --restart unless-stopped ellnic/watcher3

Any help or pointers would be greatly appreciated :slight_smile: