Docker image not exposing

蹲街弑〆低调 提交于 2019-12-24 16:10:08

问题


I have a docker image which is running perfectly in file I have done

EXPOSE 8080

and I run my image using

sudo docker run -p 8080 <image-name> <Argument1> <Argument2>

Image runs but when I go to

localhost:8080

I get page not found error. Is there no way I can see some response or something on localhost:8080?


回答1:


The option -p 8080 will expose the container:8080 port into a host:random-port.

The option --publish works as follow: -p ip:hostPort:containerPort. Using a -P| --publish-all will automatically bind any container-opened port into random-host port.

It is also possible to publish range of ports: -p 1234-1236:1222-1224.



来源:https://stackoverflow.com/questions/35478241/docker-image-not-exposing

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!