compose_port
Resolve the published host address and port for a Docker Compose service's internal port, returning all bindings.
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. For non-compose containers
read container_inspect's NetworkSettings.Ports instead.
Raises RemoteFailureError if the CLI call fails.
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
project_dir: Dir with the compose file (default: server cwd; copied to the target host if no local plugin)
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 |