Skip to content
masterclass Buddy

Docker · Option

ports

The Compose ports field maps host ports to container ports. It can also select a host IP, port range, and TCP or UDP protocol.

Last updated

Syntax

ports:
  - "[HOST:]CONTAINER[/PROTOCOL]"

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • expose
  • network_mode
  • networks
  • docker compose up

Source: Define services in Docker Compose. Checked 2026-11-03.