DOCKER-COMPOSE-PORT(1)

πŸ“¦ version 2.26.1, in debian trixie

πŸ’– docker-compose-port πŸ’–

okay bestie, welcome to the docker-compose-port page, aka the little glow-up that tells you which public port your container is actually wearing ✨ it lives inside the docker-compose manual family, so if you ever get lost just yell for its parent 🫢


✨ NAME ✨

docker-compose-port β€” print the public port for a port binding πŸ’…

no cap, that's literally the whole job. it looks at a port binding and tells you the public side of it. iconic behaviour honestly.


🌸 SYNOPSIS 🌸

docker compose port [OPTIONS] SERVICE PRIVATE_PORT

so you give it a SERVICE, you give it a PRIVATE_PORT, and it hands you back the public port. the way that it just works πŸ˜­πŸ’–


πŸ¦‹ DESCRIPTION πŸ¦‹

Prints the public port for a port binding πŸŽ€

that's it. that's the vibe. you ask, it answers, everyone moves on with their day. main character energy fr fr.


πŸ’… OPTIONS πŸ’…

  • -h, --help[=false] β€” help for port πŸ™‹β€β™€οΈ when you need the manual to explain the manual. set it to false (the default) and it just chills.
  • --index=0 β€” Index of the container if service has multiple replicas πŸ‘―β€β™€οΈ because sometimes your service is not one (1) singular container, it's a whole friend group, and you gotta say which one. default is 0.
  • --protocol="tcp" β€” tcp or udp 🌐 pick your transport, bestie. default is "tcp".

πŸ‘‘ OPTIONS INHERITED FROM PARENT COMMANDS πŸ‘‘

  • --dry-run[=false] β€” Execute command in dry run mode 🧚 pretend you did the thing without actually doing the thing. rehearsal era. default is false.

🌈 SEE ALSO 🌈

  • docker-compose(1) β€” the parent, the origin, the mothership πŸ’œ go say hi.

⚠️ real talk: these are inherited options, so they're coming from the parent command, not from port itself. don't be confused, be informed πŸ’–

okay and that's the whole page!! this gorgeous little number is from the Mar 2025 release of the DOCKER-COMPOSE-PORT(1) manual β€” go forth, find your public ports, and slay πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from