Sensible folders and permissions for Docker selfhosting?
I'm running a Raspberry Pi 4 with an external SSD to provide a few services (right now: Photoprism, The Lounge, Miniflux, planned: paperless-ng). I need to re-install the system to upgrade from Raspberry Pi OS based on Debian buster to bullseye. In addition I plan to switch to the 64-bit version because I encountered multiple problems with Docker. (Some other processes are caddy for reverse proxy, restic for backups and sshd for remote access.) Currently only Photoprism is a docker container but in the new setup I want to use containers for all applications.
Currently the disk is mounted in one directory (/srv/data) and used to store application data in various folders, everything uses mostly one user account, file permissions and ownership are inconsistent.
Since I am upgrading the operating system its time to fix that!
- Should I combine the various docker-compose files from various services into one large file?
- Is it recommended to create a new user account on the host for each service and let the service create files with that service?
- Where to mount the drive? (I considered the home directory, but I don't want the system fail to boot if the drive is disconnected.)
- What's a good directory layout for the Docker volumes? Photoprism and paperless-ng have an import directory, so they should be accessible for a low priviledge user for upload.
- How is the sudoer account best configured? I use it to manage the services and make manual changes?
If there is a sort of best-practices document for home server setup and security with Docker I am grateful for a link as well.
Posted Jan 6, 2022, 9:10 PM UTC
Here’s a link to my full config, which is really close to what you’re trying to do. https://github.com/subdavis/selfhosted
You can look at my photoprism as an example. The docker compose file is alphabetized.
Thanks for the explanation. Rootless Docker seems to be a bit of a hassle to configure. Perhaps I can use podman instead?
I will definitely consult your docker-compose file.
It’s not that bad, but all up to personal preference of course. You can’t really use podman instead because many of these containers rely on the docker socket API.
If you want to use caddy or traefik or Nginx proxy, it’s not an option.