Simon Kiely
Simon Kiely

Reputation: 6040

docker port command returning nothing

I am following the tutorial here.

In this, you launch a container like so :

docker run --name static-site -e AUTHOR="Your Name" -d -P dockersamples/static-site
e61d12292d69556eabe2a44c16cbd54486b2527e2ce4f95438e504afb7b02810

which I have done. Then it tells you to run the command :

docker port static-site

This is meant to return the ports the container is running on, right ?

It's returning nothing for me. How come ?

sudo docker ps -l shows it has been created.

Thanks a lot.

Upvotes: 1

Views: 1690

Answers (1)

bq0
bq0

Reputation: 11

On MacOS, I have following results:

$ docker run --name static-site -e AUTHOR="Your Name" -d -P dockersamples/static-site
ac25e7cdd81725dfa157ff7027d1ed6beb3839c9457b9627728d700375e7a77f

$ docker ps
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS              PORTS                                           NAMES
ac25e7cdd817        dockersamples/static-site   "/bin/sh -c 'cd /usr…"   6 seconds ago       Up 5 seconds        0.0.0.0:32774->80/tcp, 0.0.0.0:32773->443/tcp   static-site

$ docker port static-site
443/tcp -> 0.0.0.0:32773
80/tcp -> 0.0.0.0:32774

Please inspect the result of the column 'ports' of the command docker ps on your machine where ports and the mapped ports are also displayed.

Upvotes: 1

Related Questions