this article is a little bit surprising for me too
it really is a “docker” way of doing things, while podman allow to do it without this docker-compose
does it worth the effort the write a .container file to show how to do the same, with the UserNS to link container’s user UID/GID and the `:z` on volume mounts to automatically set the SELinux context for containers?
also, as far as I know, the default Alpine user is root.
If I look at the dockerfile, I see no specific user used: navidrome/Dockerfile at master · navidrome/navidrome · GitHub
which means it probably is already automatically mapped by Podman without having to set UserNS
but setting it explicitly makes sense to explain how things works
a quick and dirty file would looks like this:
[Unit]
Description=Navidrome (latest)
[Container]
ContainerName=navidrome # the service will be named navidrome.service
Image=docker.io/deluan/navidrome:latest
Timezone=local # use local system Timezone
PublishPort=4533:4533
# user/group to use inside the container
User=1000
Group=1000
# keep host's running system
UserNS=keep-id:uid=1000,gid=1000 #
# :Z content is reserved for this container
Volume=/home/nico/navidrome/Data:/data:Z
# :z content can be accessed by other containers too
Volume=/home/nico/navidrome/Music:/music:ro,z
# ressources limit (we don't want the container to crash the host system)
Memory=2g
PodmanArgs=--cpus=2
[Service]
Restart=unless-stopped
RestartSec=5s
TimeoutStartSec=300
TimeoutStopSec=30
[Install]
WantedBy=default.target
then, a damon-reload --user and a systemctl --user start navidrome.service