I have several Docker containers suffering from the same problem: after they’re restarted or re-created, they lose access to some files in their host mounted volumes. The files are still visible within the container volume (typically /config
) but are not recognized by the hosted application.
This seems to happen because within the container the files are created as root:root. In my host environment I do not have docker running as root - rather it runs as uid=997(docker).
I can restore their access to those files by issuing a $ sudo chown -R :docker *
command from my host environment and restarting the container.
In the host environment (ubuntu 20.04.1 LTS) the volumes live within my user directory /home/USER/docker
where my user is added to the docker group sudo usermod -aG docker ${USER}
The specific containers I am using that have this issue are:
- pihole/pihole:latest
- homeassistant/home-assistant:stable
- plexinc/pms-docker
- duplicati/duplicati
- esphome/esphome
How should I change my configuration to allow docker containers to access files they’ve created themselves within their volumes?