I am trying to run PiHole as a rootless container using podman.
Everything was working fine except that the real IPs were not being logged. So I had to switch from rootlesskit to slirp4netns. But now the service cannot be reached by localhost.
When using rootlesskit the port is bound to all interfaces:
pihole@pihole:~$ ss -ulpn
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
UNCONN 0 0 :1153 :* users:(("rootlessport",pid=42836,fd=14))
But when using slirp4netns, the service does not respond on localhost:
pihole@pihole:~$ ss -ulpn
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
UNCONN 0 0 0.0.0.0:1153 0.0.0.0:* users:(("slirp4netns",pid=43755,fd=10))
pihole@pihole:~$ dig google.com @localhost -p 1153
;; communications error to 127.0.0.1#1153: timed out
;; communications error to 127.0.0.1#1153: timed out
;; communications error to 127.0.0.1#1153: timed out
;; communications error to 127.0.0.1#1153: timed out
; <<>> DiG 9.18.12-1-Debian <<>> google.com @localhost -p 1153
;; global options: +cmd
;; no servers could be reached
According to the man page, using the -p option should work this way: If host IP is set to 0.0.0.0 or not set at all, the port is bound on all IPs on the host.
I am trying to run PiHole as a rootless container using podman.
Everything was working fine except that the real IPs were not being logged. So I had to switch from rootlesskit to slirp4netns. But now the service cannot be reached by localhost.
Command executed:
/usr/bin/podman run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon --replace --detach=true --name pihole-server -v /opt/pihole/etc-pihole:/etc/pihole:rw -v /opt/pihole/etc-dnsmasq.d:/etc/dnsmasq.d:rw -v /opt/pihole/resolv.conf:/etc/resolv.conf:rw -p 1153:53/tcp -p 1153:53/udp -p 1180:80/tcp --memory=512M --env-file=config.env --network=slirp4netns:port_handler=slirp4netns docker.io/guidugli/pihole-unbound:latest
When using rootlesskit the port is bound to all interfaces:
But when using slirp4netns, the service does not respond on localhost:
But it respond on the interface ip:
According to the man page, using the -p option should work this way: If host IP is set to 0.0.0.0 or not set at all, the port is bound on all IPs on the host.
Am I missing something or is this really a bug?
More info: