1.使用iptable
获得容器IP
//[container_name]为docker容器名称
docker inspect [container_name] | grep IPAddress
iptable转发端口
//例:将容器的8000端口映射到宿主机的8001端口
iiptables -t nat -A DOCKER -p tcp -dport 8001 -j DNAT --to-destination 192.169.1.1:8080
2.
docker commit -a "shijie32177" -m "centos with redis cluster" centos-redis centos-redis:v1
返回
sha256:c044f4f28a4805823dc30605df2b0d15e06ab00ba122db5d00db434266adbd80
docker run -d -p 1001:7001 -p 1002:7002 -p 1003:7003 -p 1004:7004 -p 1005:7005 -p 1006:7006 shijie32177/centos-redis
返回
b4a4c6d6cc688407aa4c102fc459875bc8e3bacdc4b2b1504daebccab522ea1d
网友评论