Maps host port 8080 to container port 80.
Section: Ports and Networks
Publish container port
yaml
yaml
services:
web:
image: nginx:alpine
ports:
- "8080:80"Explanation
Use this for browser access from the host.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Ports and Networks
Attach services to custom network
Defines multiple named networks for segmentation.
Named volume for persistent data
Stores database data in a managed named volume.