1.Docker无法启动问题
docker logs -f 6b56126963dc21cdc515d6c758f1d949c55f203d36542b27e360ddbc556ae80a
2022-06-15T05:34:33.902Z Server Listening on http://0.0.0.0:51821
2022-06-15T05:34:33.903Z WireGuard Loading configuration...
2022-06-15T05:34:33.905Z WireGuard Configuration loaded.
2022-06-15T05:34:33.905Z WireGuard Config saving...
2022-06-15T05:34:33.906Z WireGuard Config saved.
$ wg-quick down wg0
$ wg-quick up wg0
Error: Command failed: wg-quick up wg0
[#] ip link add wg0 type wireguard
[#] wg setconf wg0 /dev/fd/63
[#] ip -4 address add 10.8.0.1/24 dev wg0
[#] ip link set mtu 1420 up dev wg0
[#] iptables -t nat -A POSTROUTING -s 192.0.2.0/24 -o eth0 -j MASQUERADE; iptables -A INPUT -p udp -m udp --dport 51820 -j ACCEPT; iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT;
modprobe: can't change directory to '/lib/modules': No such file or directory
modprobe: can't change directory to '/lib/modules': No such file or directory
iptables v1.8.3 (legacy): can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
[#] ip link delete dev wg0
at ChildProcess.exithandler (child_process.js:383:12)
at ChildProcess.emit (events.js:400:28)
at maybeClose (internal/child_process.js:1058:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5) {
killed: false,
code: 3,
signal: null,
cmd: 'wg-quick up wg0'
}解决方案
modprobe ip_tables && modprobe iptable-nat2.Upgrade Linux Kernel of CentOS 8
dnf -y update
uname -r
dnf install -y https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
dnf makecache
dnf --disablerepo="*" --enablerepo="elrepo-kernel" list available | grep kernel-ml
dnf --enablerepo="elrepo-kernel" install -y kernel-ml
reboot
uname -r

yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate dokcer-logrotate docker-engin御载docker-ce(ce代表社区版)
yum remove docker-ce docker-ce-cli containerd.io删除docker资源
rm -rf /var/lib/docker2、安装依赖包
yum install -y yum-utils3、设置镜仓库(默认是国外仓库,下载非常慢)
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo4、更新yum
yum makecache5、安装docker
yum install docker-ce docker-ce-cli containerd.io如果不想安装最新版本的docker,想安装指定版本,可以这样:
先查询出docker有哪些版本
yum list docker-ce --showduplicates | sort -r安装指定版本
sudo yum install docker-ce-<version_string> docker-ce-cli-<version_string> containerd.io比如,安装18.09.1版本:
sudo yum install docker-ce-18.09.1 docker-ce-cli-18.09.1 containerd.io6、启动docker
sudo systemctl start docker查看是否启动成功
docker version7、开机自动启动docker
systemctl enable dockerDocker官方的一键安装命令,适用于CentOS / Debian / Ubuntu系统
curl -s https://get.docker.com/ | sh
或
curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh
]]>