compose_port
Look up the published host address and port for a container port in a Docker Compose service.
Instructions
Resolve the host binding for a service's container port.
The compose equivalent of docker port: which host address/port a service's private port is
published on. published is None when the port isn't published.
args:
service - Service name from the compose file
private_port - The container-internal port to look up
protocol - "tcp" (default) or "udp"
index - Container index when the service has multiple replicas (default 1)
project_dir - Dir with the compose file (default: server cwd)
files - Explicit compose file paths (repeatable, -f)
project_name - Compose project name override
returns: dict - {"service", "private_port", "protocol", "published": "host:port"|None,
"host": str|None, "port": int|None, "bindings": list[str]}.
published/host/port describe the first binding; bindings lists every
line (a port can be published on more than one address, e.g. IPv4 and IPv6).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | No | ||
| index | No | ||
| service | Yes | ||
| protocol | No | tcp | |
| project_dir | No | ||
| private_port | Yes | ||
| project_name | No |