This post will explain you to how to know the mapped port of the certain container in docker.

If you want to know the port that is mapped into the container, we can use the below command for this

docker ps --filter "expose=80"

output:

CONTAINER ID   IMAGE              COMMAND                  CREATED       STATUS       PORTS                                     NAMES
b3ded776ddc4   wordpress:latest   "docker-entrypoint.s…"   3 hours ago   Up 3 hours   0.0.0.0:31005->80/tcp, :::31005->80/tcp   container1
e3f26ef31f90   wordpress:latest   "docker-entrypoint.s…"   3 hours ago   Up 3 hours   0.0.0.0:31004->80/tcp, :::31004->80/tcp   container2
e215cc9c2be9   wordpress:latest   "docker-entrypoint.s…"   3 hours ago   Up 3 hours   0.0.0.0:31003->80/tcp, :::31003->80/tcp   container3
3b8d8029efb9   wordpress:latest   "docker-entrypoint.s…"   3 hours ago   Up 3 hours   0.0.0.0:31002->80/tcp, :::31002->80/tcp   container4
a756c4da1751   wordpress:latest   "docker-entrypoint.s…"   3 hours ago   Up 3 hours   0.0.0.0:31001->80/tcp, :::31001->80/tcp   container5

This command Display containers that have exposed TCP port in the range of PORTS->80. Docker your webserver will listen on port 80 for TCP connections since TCP is the default.