You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason is that I want to use this image in podman's rootless mode. This means podman already runs as a user on the container host system and provides security / isolation. In that case, podman maps the uid/gid 0 to the host system user. So if I have a user sabnzbd and a group sabnzbd on the host and I want files created by the container to be owned by sabnzbd:sabzbnd on the host system, then sabnzbd has to run as root inside the container. (There is a possibility to map some other uid/gid to the primary host id, but it's undocumented and complicated...).
Currently, the best I can do is setting SABNZBD_UID to 0. I would not have expected the usermod command to work, but for some reason it's partially working:
But it has the strange effect that files generated by sabnzbd are now owned by root, but the group is still set to sabnzbd messing up the permissions on the container host. So really, an explicit SABNZBD_ROOT=y would be very much appreciated.
Off-Topic
Setting up this thing in podman was a pain, so in case you want to include these instructions in the README:
Tested on Fedora 32:
# Containers can be started by systemd
setsebool -P container_manage_cgroup 1
# Create sabnzbd user. Note: --system can be used to create a system user, but /etc/subid and /etc/subgid are not set up properly in this case and must be modified manually.
useradd -d /var/lib/sabnzbd -U sabnzbd
# Disable login for user
usermod -L sabnzbd
# Allow container access to sabnzbd configuration dir and data dir
semanage fcontext -a -t container_file_t '/var/lib/sabnzbd(/.*)?'
semanage fcontext -a -t container_file_t '/media/data/download/sabnzbd(/.*)?'
restorecon -v -RF /var/lib/sabnzbd
restorecon -v -RF /media/data/download/sabnzbd
Create the systemd service in /etc/systemd/system/container-sabnzbd.service:
(note: %t in the autogenerated file had to be changed to %T).
Now run systemctl daemon-reload && systemctl start container-sabnzbd.
Run systemctl enable container-sabnzbd to start the service at boot.
systemctl status container-sabnzb shows the log, as logs are sent to the journal (logged as process conmon).
podman auto-update should work to update the container, but I couldn't test it.
It is also possible to run the container in podman without setting up a systemd service and an sabnzbd user. In that case, the chcon commands are still required for the shared volumes. The podman command can then be started manually: podman run --name sabnzbd -e SABNZBD_UID=0 -e SABNZBD_GID=0 -v datadir:/datadir -v mediadir:/media -p 10000:8080 sabnzbd/sabnzbd
Apart from the podman specific setup, I had to do two other steps:
Add the hostname of the system host / nginx reverse proxy to the configuration.
Set up nginx reverse proxy. I couldn't find a fully-working nginx documentation example, but this is what works for me:
I know, looks like a strange request at first ;-)
The reason is that I want to use this image in podman's rootless mode. This means podman already runs as a user on the container host system and provides security / isolation. In that case, podman maps the uid/gid 0 to the host system user. So if I have a user
sabnzbd
and a groupsabnzbd
on the host and I want files created by the container to be owned bysabnzbd:sabzbnd
on the host system, then sabnzbd has to run as root inside the container. (There is a possibility to map some other uid/gid to the primary host id, but it's undocumented and complicated...).Currently, the best I can do is setting
SABNZBD_UID
to 0. I would not have expected the usermod command to work, but for some reason it's partially working:But it has the strange effect that files generated by sabnzbd are now owned by root, but the group is still set to sabnzbd messing up the permissions on the container host. So really, an explicit
SABNZBD_ROOT=y
would be very much appreciated.Off-Topic
Setting up this thing in podman was a pain, so in case you want to include these instructions in the README:
Tested on Fedora 32:
Create the systemd service in
/etc/systemd/system/container-sabnzbd.service
:(note: %t in the autogenerated file had to be changed to %T).
systemctl daemon-reload && systemctl start container-sabnzbd
.systemctl enable container-sabnzbd
to start the service at boot.systemctl status container-sabnzb
shows the log, as logs are sent to the journal (logged as processconmon
).podman auto-update
should work to update the container, but I couldn't test it.It is also possible to run the container in podman without setting up a systemd service and an
sabnzbd
user. In that case, the chcon commands are still required for the shared volumes. The podman command can then be started manually:podman run --name sabnzbd -e SABNZBD_UID=0 -e SABNZBD_GID=0 -v datadir:/datadir -v mediadir:/media -p 10000:8080 sabnzbd/sabnzbd
Apart from the podman specific setup, I had to do two other steps:
The text was updated successfully, but these errors were encountered: