我已經設置了Docker容器來訪問我的機器碼頭容器到本地的另一臺機器。碼頭端口轉發不起作用
下面創建命令的容器:
docker run -it -d --name containerName -h www.myhost.net -v /var/www/html -p 7000:8000 --net mynetwork --ip 172.11.0.10 --privileged myimagename bash
創建後的容器詳細說明:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1e1e5e9b74b4 myimgaename "bash" 21 minutes ago Up 6 minutes 0.0.0.0:7000->8000/tcp containername
網絡的詳細信息:
"NetworkSettings": {
"Bridge": "",
"SandboxID": "fe357c54c816fff0f9d642037dc9a173be7f7e42a80776d006572f6a1395969e",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"8000/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "7000"
}
]
}
如果我訪問搬運工IPADDR(172.11.0.10)或主機名(www.myhost.net)在mymachine(主機)中工作
但是,如果我有端口訪問不起作用:hostmachine IP:192.168.1.1
go to the browser 192.168.1.1:7000 hostmachine and locally connected anoter machine also.
但我的7000端口是聽在hostmachine:
# ps aux | grep 7000
root 10437 0.0 0.2 194792 24572 pts/0 Sl+ 12:33 0:00 docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 7000 -container-ip 172.11.0.10 -container-port 8000
root 10941 0.0 0.0 118492 2324 pts/3 R+ 12:44 0:00 grep --color=auto 7000
更新1:
$ docker version
Client:
Version: 1.11.2
API version: 1.23
Go version: go1.5.4
Git commit: b9f10c9
Built: Wed Jun 1 21:39:21 2016
OS/Arch: linux/amd64
Server:
Version: 1.11.2
API version: 1.23
Go version: go1.5.4
Git commit: b9f10c9
Built: Wed Jun 1 21:39:21 2016
OS/Arch: linux/amd64
建議我爲什麼不能訪問m y容器到另一臺機器。如何解決這個問題
或本地碼頭? –
@ Shiraaz.M我使用本地碼頭,我使用命令行安裝(fed23)dnf安裝碼頭工人 –