Back to commands

Web Server Rescue

Read-only

Show 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.

demo@lab:~$

$ 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

  1. docker port web
  2. docker ps --filter name=web --format 'table {{.Names}}\t{{.Ports}}'

next steps

Related commands

Web Server Rescue Can be slow

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}}'
Web Server Rescue State change

Read Recent Container Logs

Skip the million-line log scroll and read only the recent failure window.

docker logs --since 10m --tail 100 api
Web Server Rescue Sensitive output

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.

  • lfcs:networking
  • lfcs:services-logs
  • risk:read-only

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.