How -p 8080:80 reaches your container
Select an icon to see what it is.
Step 1 of 6
The CLI asks for a published port
The docker CLI sends POST /containers/create to dockerd with a port binding for 80/tcp on host port 8080. Nothing is exposed yet. The binding is only stored in the container's HostConfig.
$ docker run -d --name web --network shop-net -p 8080:80 nginx PrevNext
POST /v1.45/containers/create?name=web
{"Image": "nginx""ExposedPorts": {"80/tcp": {}}"HostConfig": {"NetworkMode": "shop-net""PortBindings": {"80/tcp": [{"HostPort": "8080"}]}}}