如何解决docker的端口无法访问tcp6?

1.问题背景[root@dc02 ~]# sudo docker run -p 5601:5601 -p 9200:9200 -p 5044:5044 -it --name elk elk:v2WARNING: IPv4 forwarding is disabled. Networking will not work. * Starting periodic command scheduler cron [ OK ]

* Starting Elasticsearch Server [ OK ]

在浏览器中无法访问

2. 解决办法[root@dc02 log]# vim /usr/lib/sysctl.d/00-system.conf

加入一行

net.ipv4.ip_forward=1重启网络

[root@dc02 log]# systemctl restart network

测试网络连通性

[root@dc02 log]# ping baidu.com

PING baidu.com (123.125.115.110) 56(84) bytes of data.64 bytes from 123.125.115.110: icmp_seq=1 ttl=128 time=3.61 ms64 bytes from 123.125.115.110: icmp_seq=2 ttl=128 time=2.73 ms

重启docker

[root@dc02 log]# systemctl restart docker.service

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐