When creating a Docker container, we can map a container port to a port on the host. This tutorial demonstrates how to get port mappings of Docker container.
To retrieve port mappings of a container, use docker port
command or docker container
command with port
argument. For example, to get port mappings of a container named nginx
, you can use:
docker port nginx
docker container port nginx
Output example:
80/tcp -> 0.0.0.0:8080
80/tcp -> :::8080
Leave a Comment
Cancel reply