Web Server Rescue
Read-onlyShow Published Container Ports
You need to map container ports to host ports without scanning firewall rules.
Command
docker port web
Before you run this
System impact: Read-only. Low when scoped to the shown target.
When not to use it: Do not use it alone for firewall diagnosis; a published port can still be blocked upstream.
Expected output
80/tcp -> 0.0.0.0:8080
System impact
Read-only. Nothing changes. Docker reads port mapping metadata.
Recovery / rollback: no state is changed.
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.
Watch this command run
Command transcript
This sanitized transcript shows the commands and output shape without exposing host details.
$ docker port web
80/tcp -> 0.0.0.0:8080
$ docker ps --filter name=web --format 'table {{.Names}}\t{{.Ports}}'
local test docker: ps --filter name=web --format table {{.Names}}\t{{.Ports}}
View commands shown
These are the commands shown in the sanitized transcript.
Commands shown
docker port webdocker ps --filter name=web --format 'table {{.Names}}\t{{.Ports}}'
next steps
Related commands
Check What Is Actually Listening
The app was running. The port was not listening.
ss -tulpn | grep ':80\|:443'
Find Restarting Containers Fast
Restart loops hide in plain sight unless you filter for them.
docker ps -a --filter status=restarting --format 'table {{.Names}}\t{{.Status}}\t{{.Image}}'
Your Site Is Not Down. DNS Might Be Lying.
The browser said the site was gone. The server was answering fine.
curl --resolve example.com:443:203.0.113.10 https://example.com/
Read Recent Container Logs
Skip the million-line log scroll and read only the recent failure window.
docker logs --since 10m --tail 100 api
Show TLS Certificate Dates
The outage was not the web server. The edge certificate had expired.
openssl s_client -connect edge.test:443 -servername edge.test </dev/null 2>/dev/null | openssl x509 -noout -dates
Study mapping
Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.
Useful for
- LPIC-1 style command-line practice
- LFCS style performance tasks
- Linux+ style troubleshooting review
Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.