Skip to content

Work around tox-docker KeyError on Docker 29+#728

Merged
jonathangreen merged 1 commit intomainfrom
chore/tox-docker-gateway-workaround
Feb 12, 2026
Merged

Work around tox-docker KeyError on Docker 29+#728
jonathangreen merged 1 commit intomainfrom
chore/tox-docker-gateway-workaround

Conversation

@jonathangreen
Copy link
Member

Description

Added TOX_DOCKER_GATEWAY environment variable to the test workflow to work around a KeyError: 'Gateway' failure in tox-docker when running on Docker 29+.

Docker 29 removed the deprecated top-level NetworkSettings.Gateway key from the container inspect API. tox-docker 5.0.0 relies on this key and crashes with a KeyError. Setting TOX_DOCKER_GATEWAY=0.0.0.0 bypasses the broken lookup entirely.

This became flaky starting Feb 12 as the Docker 29 rollout to GitHub Actions runners progresses. Once complete, tests will fail 100% of the time without this fix.

This workaround can be removed once tox-docker merges the fix.

Mirrors the fix applied in circulation#3045 and library-registry#862.

Motivation and Context

CI test runs are failing intermittently with:

tox_docker/plugin.py, line 53, in get_gateway_ip
    ip = container.attrs["NetworkSettings"]["Gateway"] or "0.0.0.0"
KeyError: 'Gateway'

How Has This Been Tested?

  • CI will validate that tests pass with the workaround on Docker 29+ runners

Checklist

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

@jonathangreen jonathangreen requested a review from a team February 12, 2026 18:52
@jonathangreen jonathangreen merged commit 4d583be into main Feb 12, 2026
8 checks passed
@jonathangreen jonathangreen deleted the chore/tox-docker-gateway-workaround branch February 12, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants