我已经尝试过正常的方法(例如https://wiki.centos.org/FAQ/CentOS6#head-d47139912868bcb9d754441ecb6a8a10d41781df)。尽管sysctl net.ipv6.conf.default.disable_ipv6
在我的主机系统上返回 1,但它在我的容器内始终返回 0。
谢谢!
答案1
答案2
不幸的是,@slipper 的解决方案对我不起作用。我不得不这样做
# Disable IPv6
❯ sysctl -w net.ipv6.conf.default.disable_ipv6=1
❯ sysctl -w net.ipv6.conf.all.disable_ipv6=1
❯ service docker restart
# Test
❯ docker run -dit -p 8080:80 --name test vikas027/site-counter
❯ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e9dd5b0ce0ea vikas027/site-counter "supervisord --confi…" 2 minutes ago Up 2 minutes 0.0.0.0:8080->80/tcp test
这是我的docker版本
❯ docker version
Client:
Version: 20.10.7
API version: 1.41
Go version: go1.15.14
Git commit: f0df350
Built: Wed Nov 17 03:05:36 2021
OS/Arch: linux/amd64
Context: default
Experimental: true
Server:
Engine:
Version: 20.10.7
API version: 1.41 (minimum version 1.12)
Go version: go1.15.14
Git commit: b0f5bc3
Built: Wed Nov 17 03:06:14 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.6
GitCommit: d71fcd7d8303cbf684402823e425e9dd2e99285d
runc:
Version: 1.0.0
GitCommit: 84113eef6fc27af1b01b3181f31bbaf708715301
docker-init:
Version: 0.19.0
GitCommit: de40ad0