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?

2
  • what do you mean with private?
    – c4f4t0r
    Sep 11, 2015 at 17:47
  • @c4f4t0r Not public. Internal networking! Not visible to the rest of the internet, only within the host. Sep 11, 2015 at 18:00

1 Answer 1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.