-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Update docker #16009
Merged
Merged
Update docker #16009
Conversation
This file contains 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
Changes: - docker-library/docker@bfe953e: Merge pull request docker-library/docker#468 from infosiftr/better-iptables
Diff for f05c9a8:diff --git a/_bashbrew-cat b/_bashbrew-cat
index 083730a..0c09762 100644
--- a/_bashbrew-cat
+++ b/_bashbrew-cat
@@ -9,7 +9,7 @@ Directory: 24/cli
Tags: 24.0.7-dind, 24.0-dind, 24-dind, dind, 24.0.7-dind-alpine3.19, 24.0.7, 24.0, 24, latest, 24.0.7-alpine3.19
Architectures: amd64, arm32v6, arm32v7, arm64v8
-GitCommit: 7ac5702b51ae559c03bfe90404f4b8c63977c601
+GitCommit: eb4c40e45daf9218a21526d0ebd076b627d0b882
Directory: 24/dind
Tags: 24.0.7-dind-rootless, 24.0-dind-rootless, 24-dind-rootless, dind-rootless
@@ -45,7 +45,7 @@ Directory: 25-rc/cli
Tags: 25.0.0-rc.1-dind, 25-rc-dind, rc-dind, 25.0.0-rc.1-dind-alpine3.19, 25.0.0-rc.1, 25-rc, rc, 25.0.0-rc.1-alpine3.19
Architectures: amd64, arm32v6, arm32v7, arm64v8
-GitCommit: 458a535b2ce98b44ebf9f742061f29fdae08cea0
+GitCommit: bfe953e38b9610b085d1e0f139dbe2c39556216b
Directory: 25-rc/dind
Tags: 25.0.0-rc.1-dind-rootless, 25-rc-dind-rootless, rc-dind-rootless
diff --git a/docker_24.0.7-alpine3.19/dockerd-entrypoint.sh b/docker_24.0.7-alpine3.19/dockerd-entrypoint.sh
index c15a624..b11a1cf 100755
--- a/docker_24.0.7-alpine3.19/dockerd-entrypoint.sh
+++ b/docker_24.0.7-alpine3.19/dockerd-entrypoint.sh
@@ -143,17 +143,46 @@ if [ "$1" = 'dockerd' ]; then
# XXX inject "docker-init" (tini) as pid1 to workaround https://github.com/docker-library/docker/issues/318 (zombie container-shim processes)
set -- docker-init -- "$@"
- if ! iptables -nL > /dev/null 2>&1; then
+ iptablesLegacy=
+ if [ -n "${DOCKER_IPTABLES_LEGACY+x}" ]; then
+ # let users choose explicitly to legacy or not to legacy
+ iptablesLegacy="$DOCKER_IPTABLES_LEGACY"
+ if [ -n "$iptablesLegacy" ]; then
+ modprobe ip_tables || :
+ else
+ modprobe nf_tables || :
+ fi
+ elif (
+ # https://git.netfilter.org/iptables/tree/iptables/nft-shared.c?id=f5cf76626d95d2c491a80288bccc160c53b44e88#n420
+ # https://github.com/docker-library/docker/pull/468#discussion_r1442131459
+ for f in /proc/net/ip_tables_names /proc/net/ip6_tables_names /proc/net/arp_tables_names; do
+ if b="$(cat "$f")" && [ -n "$b" ]; then
+ exit 0
+ fi
+ done
+ exit 1
+ ); then
+ # if we already have any "legacy" iptables rules, we should always use legacy
+ iptablesLegacy=1
+ elif ! iptables -nL > /dev/null 2>&1; then
# if iptables fails to run, chances are high the necessary kernel modules aren't loaded (perhaps the host is using xtables, for example)
# https://github.com/docker-library/docker/issues/350
# https://github.com/moby/moby/issues/26824
# https://github.com/docker-library/docker/pull/437#issuecomment-1854900620
- if ! modprobe nf_tables; then
+ modprobe nf_tables || :
+ if ! iptables -nL > /dev/null 2>&1; then
+ # might be host has no nf_tables, but Alpine is all-in now (so let's try a legacy fallback)
modprobe ip_tables || :
+ if /usr/local/sbin/.iptables-legacy/iptables -nL > /dev/null 2>&1; then
+ iptablesLegacy=1
+ fi
+ fi
+ fi
+ if [ -n "$iptablesLegacy" ]; then
# see https://github.com/docker-library/docker/issues/463 (and the dind Dockerfile where this directory is set up)
export PATH="/usr/local/sbin/.iptables-legacy:$PATH"
fi
- fi
+ iptables --version # so users can see whether it's legacy or not
uid="$(id -u)"
if [ "$uid" != '0' ]; then
diff --git a/docker_25.0.0-rc.1-alpine3.19/dockerd-entrypoint.sh b/docker_25.0.0-rc.1-alpine3.19/dockerd-entrypoint.sh
index c15a624..b11a1cf 100755
--- a/docker_25.0.0-rc.1-alpine3.19/dockerd-entrypoint.sh
+++ b/docker_25.0.0-rc.1-alpine3.19/dockerd-entrypoint.sh
@@ -143,17 +143,46 @@ if [ "$1" = 'dockerd' ]; then
# XXX inject "docker-init" (tini) as pid1 to workaround https://github.com/docker-library/docker/issues/318 (zombie container-shim processes)
set -- docker-init -- "$@"
- if ! iptables -nL > /dev/null 2>&1; then
+ iptablesLegacy=
+ if [ -n "${DOCKER_IPTABLES_LEGACY+x}" ]; then
+ # let users choose explicitly to legacy or not to legacy
+ iptablesLegacy="$DOCKER_IPTABLES_LEGACY"
+ if [ -n "$iptablesLegacy" ]; then
+ modprobe ip_tables || :
+ else
+ modprobe nf_tables || :
+ fi
+ elif (
+ # https://git.netfilter.org/iptables/tree/iptables/nft-shared.c?id=f5cf76626d95d2c491a80288bccc160c53b44e88#n420
+ # https://github.com/docker-library/docker/pull/468#discussion_r1442131459
+ for f in /proc/net/ip_tables_names /proc/net/ip6_tables_names /proc/net/arp_tables_names; do
+ if b="$(cat "$f")" && [ -n "$b" ]; then
+ exit 0
+ fi
+ done
+ exit 1
+ ); then
+ # if we already have any "legacy" iptables rules, we should always use legacy
+ iptablesLegacy=1
+ elif ! iptables -nL > /dev/null 2>&1; then
# if iptables fails to run, chances are high the necessary kernel modules aren't loaded (perhaps the host is using xtables, for example)
# https://github.com/docker-library/docker/issues/350
# https://github.com/moby/moby/issues/26824
# https://github.com/docker-library/docker/pull/437#issuecomment-1854900620
- if ! modprobe nf_tables; then
+ modprobe nf_tables || :
+ if ! iptables -nL > /dev/null 2>&1; then
+ # might be host has no nf_tables, but Alpine is all-in now (so let's try a legacy fallback)
modprobe ip_tables || :
+ if /usr/local/sbin/.iptables-legacy/iptables -nL > /dev/null 2>&1; then
+ iptablesLegacy=1
+ fi
+ fi
+ fi
+ if [ -n "$iptablesLegacy" ]; then
# see https://github.com/docker-library/docker/issues/463 (and the dind Dockerfile where this directory is set up)
export PATH="/usr/local/sbin/.iptables-legacy:$PATH"
fi
- fi
+ iptables --version # so users can see whether it's legacy or not
uid="$(id -u)"
if [ "$uid" != '0' ]; then Relevant Maintainers: |
yosifkit
approved these changes
Jan 8, 2024
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.
Changes:
modprobe
always docker#468 from infosiftr/better-iptables