0

I'm using the following Docker version

Docker version 19.03.8, build afacb8b

I'm building my image using the following command

docker build -f my.Dockerfile .

which tells me

Successfully built 367dc883875e

How do I run the above image and expose port 3000? I tried this

docker run -p localhost:3000:3000 367dc883875e
docker: invalid publish opts format (should be name=value but got 'localhost:3000:3000').
See 'docker run --help'.

but get the error you see above.

satish
  • 703
  • 5
  • 23
  • 52
  • Does this answer your question? [Exposing a port on a live Docker container](https://stackoverflow.com/questions/19897743/exposing-a-port-on-a-live-docker-container) – Ganesh Kathiresan May 19 '20 at 16:18
  • Why did you include `localhost`? Look at the examples in https://docs.docker.com/engine/reference/run/. – jonrsharpe May 19 '20 at 16:19
  • 1
    From the man page: `-p, --publish ip:[hostPort]:containerPort | [hostPort:]containerPort`. It works if you specify an IP (127.0.0.1), but not with a hostname. – chash May 19 '20 at 16:22

0 Answers0