1. [Home](<https://delaparra-services.nl/>) 
1. [Knowledge hub](<https://delaparra-services.nl/knowledge-hub>) 
1. [ports](<https://delaparra-services.nl/knowledge-hub/ports>)

  

Category: Docker 

# ports

  Explained by [Reinier de la Parra](<https://delaparra-services.nl/about>)  Updated November 25, 2026    

## What is ports?

 

ports: Publishes container ports to the host, mapping HOST:CONTAINER. The Compose equivalent of docker run -p. In Docker Compose, ` ports ` publishes container ports on the host, written as ` "8080:80" `, host port first. It is the Compose version of ` docker run -p `. Services that only need to talk to each other do not need published ports at all. Inside the Compose network, the app reaches the database at ` mysql:3306 ` without any mapping. Publish ports only for what you need to reach from your own machine or the outside world.

 

Definition source [Coders Lingo](<https://coderslingo.com/resources/open-dataset/>), [CC BY 4.0](<https://creativecommons.org/licenses/by/4.0/>)

 

## Frequently asked questions about ports

  

### What should you keep in mind with ports?

 

Quote port mappings in YAML, because unquoted values like ` 22:22 ` can be read as numbers in base 60 by some YAML parsers. On shared or public servers, bind to localhost, such as ` "127.0.0.1:8080:80" `, and put a reverse proxy in front for public traffic. That keeps databases and admin tools off the internet.

    

### What does an example of ports look like?

 

```
services: web: ports: - "8080:80"
```

 

## At a glance

   CategoryDocker Explained by[Reinier de la Parra](<https://delaparra-services.nl/about>) UpdatedNovember 25, 2026

 

## More Docker terms

 

- [networks (compose)](<https://delaparra-services.nl/knowledge-hub/networks-compose>) 
- [none](<https://delaparra-services.nl/knowledge-hub/none>) 
- [port mapping](<https://delaparra-services.nl/knowledge-hub/port-mapping>) 
- [pull](<https://delaparra-services.nl/knowledge-hub/pull>) 
- [push](<https://delaparra-services.nl/knowledge-hub/push>) 
- [registry](<https://delaparra-services.nl/knowledge-hub/registry>)

 

[All terms starting with P](<https://delaparra-services.nl/knowledge-hub#letter-p>)

 

## Skills

 

- ### Docker Project Foundations

 

Use this skill when setting up, initializing, or Dockerizing a project, even if the user doesn't explicitly mention Docker but describes a need for containerized local development, adding a database or cache dependency, or running services without host-level installs. Covers Dockerfile, compose.yaml, and .dockerignore creation with Docker best practices.

 [View skill](<https://delaparra-services.nl/skills/docker-project-foundations>) [Download zip](<https://delaparra-services.nl/skills/docker-project-foundations/download>) 
- ### Docker Compose Patterns

 

Use this skill when creating, modifying, or debugging Docker Compose configurations, even if the user just says they need to wire services together, add a database to their stack, or set up a local development environment with multiple containers. Covers service definitions, health checks, dependency ordering, volumes, networks, environment variables, and development overrides.

 [View skill](<https://delaparra-services.nl/skills/docker-compose-patterns>) [Download zip](<https://delaparra-services.nl/skills/docker-compose-patterns/download>) 
- ### Docker Build Strategies

 

Use this skill when writing, reviewing, or optimizing Dockerfiles, even if the user just says their image is too large, their build is slow, or they need to harden a container for production. Covers multi-stage builds, layer caching, .dockerignore, non-root users, and image size optimization.

 [View skill](<https://delaparra-services.nl/skills/docker-build-strategies>) [Download zip](<https://delaparra-services.nl/skills/docker-build-strategies/download>)

 [Download all skills (zip)](<https://delaparra-services.nl/knowledge-hub/ports/skills.zip>)

 

## Manuals

 

- [Docker for your Laravel app](<https://delaparra-services.nl/manuals/docker-voor-je-laravel-app>) 
- [Deploying a Laravel app](<https://delaparra-services.nl/manuals/je-laravel-app-online-zetten>)

 

## Related services

 

- [Custom software and web applications](<https://delaparra-services.nl/services#service-03>)

Perhaps your customers need somewhere to download their invoices, or your staff are managing bookings in a spreadsheet.

 

## Need any help?

 

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.

  [Get in touch](<https://delaparra-services.nl/availability>)

[HTML version](https://delaparra-services.nl/knowledge-hub/ports)
