编译安装cri-dockerd
编译cri-dockerd时,按照官方文档操作 安装golang时timeout
·
根据kubernetes官方文档安装容器运行时(Container Runtime)时,根据指示来到了cri-dockerd的GitHub,发现需要自己用golang编译安装,而根据cri-dockerd的指示进行到golang的安装时却报错:Getting current Go version failed: Get https://golang.org/VERSION?m=text: dial tcp 172.217.160.81:443: i/o timeout
官方的原版操作指导:
# Run these commands as root
###Install GO###
wget https://storage.googleapis.com/golang/getgo/installer_linux
chmod +x ./installer_linux
./installer_linux # 在这一步会报错 timeout
source ~/.bash_profile
cd cri-dockerd
mkdir bin
go build -o bin/cri-dockerd
# 以上步骤就是下载golang然后用golang编译源码,生成cri-dockerd文件。既然官方教程会timeout,行不通,我们可以自己找个golang的环境进行编译,然后把编译好的cri-dockerd放到cri-dockerd/bin目录下就行了
mkdir -p /usr/local/bin
install -o root -g root -m 0755 bin/cri-dockerd /usr/local/bin/cri-dockerd
cp -a packaging/systemd/* /etc/systemd/system
sed -i -e 's,/usr/bin/cri-dockerd,/usr/local/bin/cri-dockerd,' /etc/systemd/system/cri-docker.service
systemctl daemon-reload
systemctl enable cri-docker.service
systemctl enable --now cri-docker.socket
我不想安装golang的环境,于是选择在golang的容器中进行编译:
> docker pull golang
# 下载cri-dockerd的源码,目录就是cri-dockerd
> docker run -it --rm -v $PWD/cri-dockerd:/usr/src/cri-dockerd -w /usr/src/cri-dockerd golang:latest
> mkdir bin
> go build -o bin/cri-dockerd
这下就得到了编译后的cri-dockerd,可以继续按照官方文档进行后续操作了
更多推荐
已为社区贡献3条内容
所有评论(0)