-
-
Notifications
You must be signed in to change notification settings - Fork 369
Open
Conversation
Commit 84a119f switched --bind-addr to "[::]:8443" for dual-stack, but binding fails with EAFNOSUPPORT when IPv6 is disabled in the kernel, leaving code-server unreachable. Detect IPv6 via /proc/net/if_inet6 and fall back to 0.0.0.0:8443 when it is unavailable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for opening this pull request! Be sure to follow the pull request template!
pinguinfuss
commented
Jul 6, 2026
Author
Relates to #218
madpeteguy
madpeteguy
approved these changes
Jul 15, 2026
One suggestion: it might be useful to adjust the BIND_ADDR from outside the container by setting an environment parameter. It's only two more lines of code:
in File root/etc/s6-overlay/s6-rc.d/svc-code at line 21
if [[ -z ${BIND_ADDR} ]]; then
# Bind to the IPv6 wildcard (dual-stack, also serves IPv4) when IPv6 is
# available, otherwise fall back to the IPv4 wildcard. Binding to "[::]"
# fails outright on hosts/containers where IPv6 is disabled.
if [[ -e /proc/net/if_inet6 ]]; then
BIND_ADDR="[::]:8443"
else
BIND_ADDR="0.0.0.0:8443"
fi
fi
Updates for README.md and an example showing how to handle it:
---
services:
code-server:
image: lscr.io/linuxserver/code-server:latest
container_name: code-server
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
- PASSWORD=password #optional
- HASHED_PASSWORD= #optional
- SUDO_PASSWORD=password #optional
- SUDO_PASSWORD_HASH= #optional
- PROXY_DOMAIN=code-server.my.domain #optional
- DEFAULT_WORKSPACE=/config/workspace #optional
- PWA_APPNAME=code-server #optional
- BIND_ADDR="[::]:8443" #optional
volumes:
- /path/to/code-server/config:/config
ports:
- 8443:8443
restart: unless-stopped
docker run -d \
--name=code-server \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Etc/UTC \
-e PASSWORD=password `#optional` \
-e HASHED_PASSWORD= `#optional` \
-e SUDO_PASSWORD=password `#optional` \
-e SUDO_PASSWORD_HASH= `#optional` \
-e PROXY_DOMAIN=code-server.my.domain `#optional` \
-e DEFAULT_WORKSPACE=/config/workspace `#optional` \
-e PWA_APPNAME=code-server `#optional` \
-e BIND_ADDR="[::]:8443" #optional
-p 8443:8443 \
-v /path/to/code-server/config:/config \
--restart unless-stopped \
lscr.io/linuxserver/code-server:latest
1 task
LinuxServer-CI
commented
Sep 6, 2026
Collaborator
This pull request has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.
RoboMagus
commented
Sep 6, 2026
Keep it open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
linuxserver.io
Description:
Commit 84a119f (#216) switched
--bind-addrto"[::]:8443"so the service listens on both IPv4 and IPv6 via dual-stack. This works fine when an IPv6 stack is present (even on IPv4-only networks), but it fails outright when IPv6 is disabled at the kernel level (e.g.ipv6.disable=1, kernel built withoutCONFIG_IPV6, or the module not loaded). In that case there is noAF_INET6socket family, so binding to[::]fails withEAFNOSUPPORTand code-server never starts — the container becomes unreachable.This PR detects IPv6 availability at startup via the presence of
/proc/net/if_inet6(the standard indicator that the kernel has IPv6 support) and chooses the bind address accordingly:[::]:8443(dual-stack, unchanged behaviour from listen on both ipv4 and ipv6 even when running container as root #216 )0.0.0.0:8443(IPv4 fallback)Both the root and non-root exec paths use the shared
BIND_ADDRvariable.Benefits of this PR and context:
Restores the ability to run the container on hosts/kernels with IPv6 disabled, which regressed after #216, while fully preserving the dual-stack behaviour that #216 introduced for everyone else. No configuration or environment variables are required — the correct address is selected automatically.
How Has This Been Tested?
Verified in a container inheriting a host kernel with IPv6 fully disabled
(
/proc/net/if_inet6and/proc/sys/net/ipv6absent):[::]:8443fails with[Errno 97] Address family not supported by protocol(reproduces the regression).0.0.0.0:8443succeeds.[[ -e /proc/net/if_inet6 ]]correctly evaluates false, so the script selects the0.0.0.0fallback.On a normal dual-stack host
/proc/net/if_inet6is present and the script keeps[::]:8443, so existing IPv4+IPv6 behaviour is unchanged.Source / References:
--bind-addr "[::]:8443")(only IPv6-less networks with the stack still present).
Container does not work on host with ipv6 disabled docker-swag#92