Closed jwillikers closed 1 year ago
Run with --dryrun to see what the output is.
Looks like you are attempting to run a container that will bind to port 80 as a rootless user. This will never be allowed on the host system
So, I can bind to port 80 and 443 with my rootless Caddy container when running the container via podman run
and also as a systemd service generated by podman generate systemd
. I've set net.ipv4.ip_unprivileged_port_start
to 80
to make this possible.
$ sudo sysctl -n net.ipv4.ip_unprivileged_port_start
80
However, I don't understand why it is failing when running via quadlet with the same configuration. Even if I change the host ports to be higher, i.e. PublishPort=8080:80
and PublishPort=8443:443
, it still seems to fail inside the container when binding to the container's port 80
/ `443. The following error message comes from inside the container.
http app module: start: listening on :443: listen tcp :443: bind: permission denied
It seems that you are failing inside the container and not on the host network. I did not try it yet, but could this RemapUsers=keep-id
be the reason? I didn't see that you are passing the equivalent flag when using podman run
@ygalblum Right! I just figured that out. I assumed that RemapUsers=keep-id
was the equivalent of passing --userns keep-id
to podman run
on the command-line.
@jwillikers It is, but you're not setting that in your podman run
command. If I'm not mistaken the issue here is that you keep the user id from the host, but do not keep the configuration of net.ipv4.ip_unprivileged_port_start
. As a result, you have a non-privileged user trying to bind to a privileged port inside the container
You're right, my mistake there. For some season I thought I was using that in my Podman run command since I use it everywhere else. Thanks!
Issue Description
Running a podman container using quadlet hits permission issues in the container when attempting to bind to port 80 / 443. This same container has no issues when run directly with
podman-run
.Steps to reproduce the issue
Steps to reproduce the issue
~/.config/containers/systemd/podman1.network
.~/.config/containers/systemd/caddy.container
.Describe the results you received
The container was constantly restarted because it failed to bind to port 80 / 443.
Describe the results you expected
I expected the container to just work as it does when running with
podman run
:podman info output
Podman in a container
No
Privileged Or Rootless
Rootless
Upstream Latest Release
Yes
Additional environment details
aarch64, Quartz64, Manjaro
Additional information
The same issue occurs using a generated kubernetes YAML with a
caddy.kube
quadlet file.