Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mailsail docker dont start because of missing ipv6 #2135

Open
elraro opened this issue Feb 2, 2025 · 0 comments
Open

mailsail docker dont start because of missing ipv6 #2135

elraro opened this issue Feb 2, 2025 · 0 comments
Labels
⚡ Type: Bug Something isn't working

Comments

@elraro
Copy link

elraro commented Feb 2, 2025

Mainsail Version:

edge

Browser:

Firefox

Device:

Desktop PC

Operating System:

Windows

What happened?

If you use Docker containers with IPV6 disabled, mainsail is not able to start.

/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: ipv6 not available
/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2025/02/02 18:41:05 [emerg] 1#1: socket() [::]:80 failed (97: Address family not supported by protocol)
nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)

Maybe because PR https://github.com/mainsail-crew/mainsail/pull/2030/files

What did you expect to happen instead?

Maybe is a good idea use ENV and a Docker entrypoint script. For example:

#!/bin/sh

CONFIG_FILE="/etc/nginx/conf.d/default.conf"

if [ "$IPV6" = "disabled" ]; then
    echo "IPv6 is disabled. Removing IPv6 listen directive from Nginx config."
    sed -i '/listen \[::\]:80;/d' "$CONFIG_FILE"
fi

Then, modify the Dockerfile:

...
COPY nginx-ipv6.sh /docker-entrypoint.d/nginx-ipv6.sh
...

And finally run with IPV6 ENV flag to disable IPV6:

docker run \
  --name mainsail \
  -v "$(pwd)/config.json:/usr/share/nginx/html/config.json" \
  -p "8080:80" \
  -e IPV6=disabled \
  ghcr.io/mainsail-crew/mainsail 

How to reproduce this bug?

You can create a Docker network without IPV6 support, just dont use the flag --ipv6

docker create network ...

And attach this network to your container. Im my case, im using this ipvlan network:

[
    {
        "Name": "vlan100",
        "Id": "b0a3b26d77117200719cd82df34f857dc9c21fadeff88689e33717cee08306e6",
        "Created": "2023-01-20T16:38:28.743335437Z",
        "Scope": "local",
        "Driver": "ipvlan",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "192.168.100.0/24",
                    "Gateway": "192.168.100.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {

Additional information:

No response

@elraro elraro added the ⚡ Type: Bug Something isn't working label Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚡ Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant