Skip to content

Commit

Permalink
Restore original behavior of community.docker 2.x.y to pass the first…
Browse files Browse the repository at this point in the history
… network on for API version < 1.44.
  • Loading branch information
felixfontein committed Jul 20, 2024
1 parent 07e4357 commit 4403846
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions changelogs/fragments/933-docker_container-networks.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
minor_changes:
- "docker_container - when creating a network, directly pass the networks to connect to to the Docker Daemon.
This makes creation more efficient and works around a bug in Docker Daemon that does not use the specified
MAC address in at least some cases, though only for creation (https://github.com/ansible-collections/community.docker/pull/933)."
- "docker_container - when creating a container, directly pass all networks to connect to to the Docker Daemon
for API version 1.44 and newer. This makes creation more efficient and works around a bug in Docker Daemon that
does not use the specified MAC address in at least some cases, though only for creation
(https://github.com/ansible-collections/community.docker/pull/933)."
bugfixes:
- "docker_container - restore behavior of the module from community.docker 2.x.y that passes the first network
to the Docker Deamon while creating the container (https://github.com/ansible-collections/community.docker/pull/933).
known_issues:
- "docker_container - when specifying a MAC address for a container's network, and the network is attached
after container creation (for example, due to idempotency checks), the MAC address is at least in some
Expand Down
6 changes: 3 additions & 3 deletions plugins/module_utils/module_container/docker_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,10 @@ def create_container(self, client, container_name, create_parameters, networks=N
if networks is not None:
create_parameters = create_parameters.copy()
create_parameters['NetworkingConfig'] = {
'EndpointsConfig': {
network: self._create_endpoint_config(network_params)
'EndpointsConfig': dict(
(network, self._create_endpoint_config(network_params)
for network, network_params in networks.items()
}
)
}
new_container = client.post_json_to_json('/containers/create', data=create_parameters, params=params)
client.report_warnings(new_container)
Expand Down

0 comments on commit 4403846

Please sign in to comment.