When attempting to run Apache inside a systemd container that was started with systemd-nspawn --private-users=pick ...
(unlike --private-users=false
in this solution) I encounter this error:
Permission denied: AH00072: make_sock: could not bind to address ...:999
What puzzles me is that the container has been granted capability CAP_NET_BIND_SERVICE
(getpcaps 1
inside the container also confirms this), --capability=help
indicates that the capability is supported, and netcat -l 999 -s ...
(also inside the container) can apparently listen on the same port just fine.
What am I missing? Shouldn't the capability allow processes inside the container to open well-known ports on the host, no matter what their PIDs are?
UPDATE I made a mistake with the invocation of netcat
. The correct command line is netcat -vl -p 999 -s ...
and this now produces "Can't grab ...:999 with bind : Permission denied". So in fact neither Apache nor netcat can bind at this point, and this is not Apache-specific. Two more facts about the configuration: container is running as root
(mapped to non-root pid on host), iptables
on host are empty.
UPDATE So perhaps capability CAP_NET_BIND_SERVICE
simply cannot transcend user namespaces.