docker service create --name cache --publish published=6379,target=6379 redis:7
Create a service with explicit publish syntax
The long --publish syntax separates the host port (published) from the container port (target), allowing ranges and modes. published=6379,target=6379 equals -p 6379:6379. Useful when the two ports differ.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.