1
docker run -it -p 8080 myimage /bin/bash

I would expect the code above to expose port 8080 private. However when I run:

docker ps -a

It shows:

0.0.0.0:32770->8080/tcp

How does one set port 8080 to expose only private?

Karl Morrison
  • 1,621
  • 4
  • 29
  • 43

1 Answers1

0

Just realized that it is by default open within the host, so just removing the port flag from run was enough.

Bonus: You may map a port to the host directly via the flag -p 127.0.0.1:8080:8080

Karl Morrison
  • 1,621
  • 4
  • 29
  • 43