443 8088 22 端口是初始映射端口 [root@SERVER ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
96b2d3c6c99d inits/source1.0.3 "/usr/sbin/sshd -D" hours ago Up hours 0.0.0.0:->/tcp, 0.0.0.0:->/tcp, 0.0.0.0:->/tcp elegant_blackwell
iptables策略 [root@SERVER ~]# iptables -t nat -L -n
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
DOCKER all -- 0.0.0.0/ 0.0.0.0/ ADDRTYPE match dst-type LOCAL Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- 172.17.0.0/ 0.0.0.0/
MASQUERADE tcp -- 172.17.0.15 172.17.0.15 tcp dpt:
MASQUERADE tcp -- 172.17.0.15 172.17.0.15 tcp dpt:
MASQUERADE tcp -- 172.17.0.15 172.17.0.15 tcp dpt: Chain OUTPUT (policy ACCEPT)
target prot opt source destination
DOCKER all -- 0.0.0.0/ !127.0.0.0/ ADDRTYPE match dst-type LOCAL Chain DOCKER ( references)
target prot opt source destination
DNAT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8088 to:172.17.0.15:8088
DNAT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:443 to:172.17.0.15:443
DNAT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:1038 to:172.17.0.15:22
新增映射端口
iptables -t nat -A DOCKER ! -i br0 -p tcp -m tcp --dport -j DNAT --to-destination 172.17.0.15: