Skip to content

Fix /pull network reconnect for aliases, static IPs and links - #10

Merged
dervish666 merged 2 commits into
masterfrom
fix/pull-network-reconnect-kwargs
Oct 29, 2026
Merged

dervish666 merged 2 commits into
masterfrom
fix/pull-network-reconnect-kwargs

Conversation

@dervish666

Copy link
Copy Markdown
Owner

After /pull the bot recreates a container and reconnects its secondary networks. v0.22.5 passed docker inspect keys (Aliases, IPAMConfig, Links) straight to docker-py, which rejects them, so networks with an alias, static IP or link were dropped.

Now mapped to docker-py's real keywords (read from the installed signature), links converted to (name, alias) pairs, own short id dropped from aliases, already-joined networks skipped.

Tests run real docker-py and fail on a wrong kwarg (1509 pass). Checked in a throwaway container on a Mac Docker: alias, static IP and link survive.

Not checked: older engines, IPv6, link-local or driver_opt against a real engine.

Drafts the 0.22.6 changelog entry only, no version bump.

pull_and_recreate passed each secondary network's endpoint from docker
inspect straight to docker-py's Network.connect() as Aliases=, IPAMConfig=
and Links=. docker-py only accepts snake_case keywords, so any network with
an alias, a static IP or a link failed with "unexpected keyword argument"
and was dropped. Only networks with none of those reconnected.

- Translate the endpoint to aliases, links (name/alias pairs, which
  normalize_links() unpacks), ipv4_address, ipv6_address, link_local_ips
  and driver_opt. Keyword names are checked against the installed
  connect_container_to_network() signature; anything it lacks is logged
  and skipped.
- Drop the old container's short ID from aliases (engines before API 1.45
  list it there) and leave the assigned MAC address unpinned.
- Skip a network the recreated container already joined, such as bridge
  when NetworkMode is "default", instead of reporting a failure.
- networks.get() now runs off the event loop like the other Docker calls.

The previous test asserted connect(container, Aliases=[...]) on a mock and
passed. The new tests drive real docker-py (DockerClient, Network.connect,
EndpointConfig) and check the request body for alias, static IPv4 and
IPv6, links, driver options, none, the short-ID alias and an assigned MAC.
Adds an Unreleased entry and corrects the 0.22.5 entry, which said a
/pull reconnected every secondary network. It reconnected only those
with no alias, static IP or link. Version stays at 0.22.5.
@dervish666
dervish666 merged commit 1509365 into master Oct 29, 2026
1 check passed
@dervish666
dervish666 deleted the fix/pull-network-reconnect-kwargs branch October 29, 2026 17:34
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.

1 participant