Skip to content

Shaarli Docker unable to start in an IPv4-only environment #2174

@immanuelfodor

Description

@immanuelfodor

Extracted from #1983 (comment)

Actually, this PR breaks running Shaarli on an IPv4-only host. Docker output:

nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)
nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)
nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)
nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)
nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)
nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)
nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)

It's a Ubuntu VM with these flags set for the kernel:
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1
On the VM, it's containerd running RKE2 configured with IPv4-only pod CIDRs. Within the pods, there is no sign of IPv6 at all:

/var/www/shaarli # ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0@if88: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1450 qdisc noqueue state UP qlen 1000
    link/ether ca:91:e4:4c:38:f3 brd ff:ff:ff:ff:ff:ff
    inet 10.42.0.82/32 scope global eth0
       valid_lft forever preferred_lft forever

/var/www/shaarli # cat /proc/net/if_inet6
cat: can't open '/proc/net/if_inet6': No such file or directory

I have a temporary workaround with a custom Docker file based on the upstream Shaarli image to delete that line from the nginx config, but it should be configurable like other projects do such as Harbor, n8n, Healthchecks, the base Nginx image, etc.

They either offer a disable ipv6 env for the dockerfile (Harbor), allow setting a custom listen host/port (n8n, Healthchecks), or proactively check ipv6 availability (Nginx base image).

I opened a PR to fix Bento PDF yesterday, but it was easier, they are based on Nginx with an available internal way to execute custom logic at the entrypoint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugit's broken!dockercontainers & cloud

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions