Files
community.docker/tests
Vedant Madane 2950337e48 Add command_as_args option for docker_swarm_service CLI-compatible mapping (#1307)
* fix: map docker_swarm_service command/args to ContainerSpec.Args

docker service create IMAGE [COMMAND] [ARG...] places post-image tokens
into ContainerSpec.Args so the image ENTRYPOINT is preserved. The module
previously wrote command to ContainerSpec.Command, which replaced the
entrypoint and broke flag-style commands such as -config.file=...

Fixes #1044
Fixes #212

* Add command_as_args option for CLI-compatible command mapping

Keep the historical default (command -> ContainerSpec.Command,
args -> ContainerSpec.Args) to avoid a breaking change. When
command_as_args=true, map command+args to ContainerSpec.Args to
match docker service create and preserve the image ENTRYPOINT.

Update docs, examples, unit tests for both modes, and the changelog
fragment. Addresses review feedback on #1307 / #1044.

* Update changelogs/fragments/1044-swarm-service-command-args.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/docker_swarm_service.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/docker_swarm_service.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/docker_swarm_service.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/docker_swarm_service.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/docker_swarm_service.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/docker_swarm_service.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/docker_swarm_service.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update changelogs/fragments/1044-swarm-service-command-args.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: VedantMadane <vedant@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
2026-08-17 21:32:57 +02:00
..
2026-03-27 14:29:49 +01:00
2025-08-03 14:18:29 +02:00
2026-04-06 22:07:34 +02:00
2026-06-23 19:21:37 +02:00