Skip to content

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

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

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

Conversation

@jonathangreen
Copy link
Copy Markdown
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.

Motivation and Context

CI test runs on Python 3.14 (and occasionally 3.12/3.13) 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.

Docker 29 removed the deprecated top-level NetworkSettings.Gateway
key from the container inspect API, causing tox-docker to fail with
a KeyError. Setting TOX_DOCKER_GATEWAY bypasses the broken lookup.
jonathangreen added a commit to ThePalaceProject/virtual-library-card that referenced this pull request Feb 12, 2026
## 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](https://docs.docker.com/engine/release-notes/29/) 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](actions/runner-images#13474) 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](tox-dev/tox-docker#196).

Mirrors the fix applied in
[circulation#3045](ThePalaceProject/circulation#3045)
and
[library-registry#862](ThePalaceProject/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

- [x] I have updated the documentation accordingly.
- [x] All new and existing tests passed.
jonathangreen added a commit to ThePalaceProject/circulation that referenced this pull request Feb 12, 2026
## 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](https://docs.docker.com/engine/release-notes/29/) 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](actions/runner-images#13474) 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](tox-dev/tox-docker#196).

Mirrors the fix applied in
[library-registry#862](ThePalaceProject/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

- [x] I have updated the documentation accordingly.
- [x] All new and existing tests passed.
@jonathangreen jonathangreen merged commit 27347e3 into main Feb 12, 2026
14 of 15 checks passed
@jonathangreen jonathangreen deleted the fix/tox-docker-gateway-workaround branch February 12, 2026 19:00
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