The docker port
command is used to display the public-facing port(s) of a container. It shows the mapping between the container’s internal port and the corresponding host port.
To use the docker port
command, you can follow these steps:
-
Make sure you have Docker installed and running on your system.
-
Open a terminal or command prompt.
-
To view the port mappings of a running container, you need to know the container’s ID or name. You can find the ID or name of the container by using the
docker ps
command:docker ps
This will display a list of running containers along with their details.
-
Once you have the container ID or name, you can use the
docker port
command followed by the container ID or name: