我在centos6.7碼頭工具集合中運行jboss5。訪問碼頭集裝箱內的jboss 8080端口
JBoss上運行使用run.sh -b 0.0.0.0
命令 集裝箱使用docker run -i -t -p 8080:8080 my/jboss /bin/bash
這是我在容器看到運行
[[email protected] bin]# netstat -alnt
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:8009 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:8083 0.0.0.0:* LISTEN
這是我在主機上看到
15:04:17:(~)$ sudo docker ps
[sudo] password for c0rp:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e44f2bbab31a my/jboss "/bin/bash" 4 hours ago Up 4 hours 0.0.0.0:8080->8080/tcp thirsty_franklin
當我試圖從主機訪問jboss應用程序通過localhost:8080
我看到ERROR 404: Not Found.
當我檢查本地主機:從容器內使用wget
8080我看到同樣的錯誤ERROR 404: Not Found.
一切都OK了,如果我使用的容器的IP地址。問題是我如何將主機localhost:8080綁定到容器ip_address:8080?