Docker图像不曝光 [英] Docker image not exposing
问题描述
我有一个运行完美的码头图像我已经完成了
I have a docker image which is running perfectly in file I have done
EXPOSE 8080
我使用
sudo docker run -p 8080 <image-name> <Argument1> <Argument2>
图像运行,但当我去
localhost:8080
我找不到页面错误。有没有办法可以在localhost上看到一些响应或某事:8080?
I get page not found error. Is there no way I can see some response or something on localhost:8080?
推荐答案
选项 p 8080
将容器:8080端口暴露在主机中:随机 -port。
The option -p 8080
will expose the container:8080 port into a host:random-port.
选项 - 发布
的工作如下: -p ip:hostPort:containerPort
。使用 -P | --publish-all
将自动将任何容器打开的端口绑定到随机主机端口。
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.
还可以发布端口范围: -p 1234-1236:1222-1224
。
It is also possible to publish range of ports: -p 1234-1236:1222-1224
.
这篇关于Docker图像不曝光的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!