Skip to content

Fix CI: work around tox-docker Gateway KeyError on newer Docker#243

Merged
rudokemper merged 3 commits into
mainfrom
242/fix-tox-docker-issues
Jun 9, 2026
Merged

Fix CI: work around tox-docker Gateway KeyError on newer Docker#243
rudokemper merged 3 commits into
mainfrom
242/fix-tox-docker-issues

Conversation

@rudokemper

Copy link
Copy Markdown
Member

Goal

Closes #242. Unblock alerts tox env on CI.

This was not a Python / pip version issue as initially suspected, but rather a discrepancy between tox-docker and ubuntu-2404:current.

What I changed and why

We set TOX_DOCKER_GATEWAY: localhost in .circleci/config.yml.

Newer Docker on ubuntu-2404:current no longer fills top-level NetworkSettings.Gateway, so tox-docker seems to crash with a KeyError. Claude Opus 4.7 did this diagnosis:

tox-docker has a documented escape hatch for exactly this: if TOX_DOCKER_GATEWAY is set, it skips container.attrs["NetworkSettings"]["Gateway"] and uses socket.gethostbyname(gateway) instead. Setting it to localhost resolves to 127.0.0.1, which is what you want on machine-executor anyway (host networking).

How I convinced myself this is right

  • Trace lands in tox-docker, not our code; pip freeze is identical to previous green runs on CircleCI.
  • alerts tests seems to be passing again in CI.

What I'm not doing here

  • Pinning ubuntu-2404 to a dated tag.

LLM use disclosure

Claude Opus 4.7 helped diagnose.

@rudokemper rudokemper requested a review from IamJeffG June 8, 2026 16:47
Comment thread .circleci/config.yml Outdated
PIP_UPLOADED_PRIOR_TO: P7D
# Skip tox-docker's NetworkSettings.Gateway lookup (broken on newer
# Docker in ubuntu-2404:current). machine-executor reaches containers
# via localhost anyway.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you mind labeling this as a temp workaround until tox-dev/tox-docker#196 is released?

(if you agree that's true)

@rudokemper rudokemper merged commit c9a364a into main Jun 9, 2026
1 check passed
@rudokemper rudokemper deleted the 242/fix-tox-docker-issues branch June 9, 2026 18:32
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.

Tests are failing on alerts, likely a Python version issue in CI

2 participants