The set of commands docker container inspect and docker port cannot identify the published port(s) for a container. The docker container inspect command returns low-level information on a container, such as its ID, name, state, network settings, mounts, etc1. However, it does not show the port mappings between the container and the host2. The docker port command lists the port mappings or a specific mapping for a container, but it requires the container name or ID as an argument3. Therefore, to identify the published port(s) for a container, you need to use both commands together, such as docker port $(docker container inspect -f '{{.Name}}' CONTAINER)4. References:
docker container inspect | Docker Docs
How to inspect a running Docker container - Stack Overflow
docker port | Docker Docs
List port for Docker container using command line - Stack Overflow
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit