Web Server Rescue
Show Published Container Ports
You need to map container ports to host ports without scanning firewall rules.
Command
docker port web
What changed
Nothing changes. Docker reads port mapping metadata.
Danger
safe
When to use it
Use when HTTP, SSH, database, or admin ports are unreachable from outside the container.
When not to use it
Do not use it alone for firewall diagnosis; a published port can still be blocked upstream.
Undo or recovery
No undo needed because this command is read-only.
Expected output
80/tcp -> 0.0.0.0:8080
demo script
Disposable terminal steps
docker port webdocker ps --filter name=web --format 'table {{.Names}}\t{{.Ports}}'
simulated output
What it looks like
::fixture-ready::
$ docker port web
80/tcp -> 0.0.0.0:8080
::exit-code::0
$ docker ps --filter name=web --format 'table {{.Names}}\t{{.Ports}}'
fake docker: ps --filter name=web --format table {{.Names}}\t{{.Ports}}
::exit-code::0
YouTube Short
Find Docker port mappings.
If the app is unreachable, first confirm Docker published the port. docker port shows the mapping directly.
LinkedIn hook
When a service is unreachable, confirm Docker is publishing the port you think it is.
Question: What is your first check when a containerized web service is unreachable?
experiments
A/B tests to run
Metric: click_through_rate
A: Confirm Docker published the port you think it did.
B: Unreachable service? Check the Docker port map first.