概述
1 引言
之前有同事问我怎么安装特定版本的docker,特此写个笔记
2 安装
- 下载安装包到/opt/docker/work下
mkdir /opt/docker/work -pv
https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.17.0/crictl-v1.17.0-linux-amd64.tar.gz
https://github.com/opencontainers/runc/releases/download/v1.0.0-rc10/runc.amd64
https://github.com/containernetworking/plugins/releases/download/v0.8.5/cni-plugins-linux-amd64-v0.8.5.tgz
https://github.com/containerd/containerd/releases/download/v1.3.3/containerd-1.3.3.linux-amd64.tar.gz
- 解压 cd /opt/docker/work
mkdir containerd
tar -xvf containerd-1.3.3.linux-amd64.tar.gz -C containerd
tar -xvf crictl-v1.17.0-linux-amd64.tar.gz
mkdir cni-plugins
sudo tar -xvf cni-plugins-linux-amd64-v0.8.5.tgz -C cni-plugins
sudo mv runc.amd64 runc
- 拷贝到自己的目录下
mkdir -p /opt/docker/bin
export PATH=/opt/docker/bin:$PATH
cp {containerd/bin/* ,crictl ,cni-plugins/* ,runc } /opt/docker/bin/
chmod a+x /opt/docker/bin/*
##创建配置文件目录
mkdir -p /etc/cni/net.d
- 创建配置文件
cat << EOF | sudo tee containerd-config.toml
version = 2
root = "${CONTAINERD_DIR}/root"
state = "${CONTAINERD_DIR}/state"
[plugins]
[plugins."io.containerd.grpc.v1.cri"]
sandbox_image = "registry.cn-beijing.aliyuncs.com/images_k8s/pause-amd64:3.1"
[plugins."io.containerd.grpc.v1.cri".cni]
bin_dir = "/opt/docker/bin"
conf_dir = "/etc/cni/net.d"
[plugins."io.containerd.runtime.v1.linux"]
shim = "containerd-shim"
runtime = "runc"
runtime_root = ""
no_shim = false
shim_debug = false
EOF
mkdir -p /etc/containerd/ ${CONTAINERD_DIR}/{root,state}
cp containerd-config.toml /etc/containerd/config.toml
- 创建 containerd systemd unit 文件
cd /opt/docker/work
cat <<EOF | sudo tee containerd.service
[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target
[Service]
Environment="PATH=/opt/k8s/bin:/bin:/sbin:/usr/bin:/usr/sbin"
ExecStartPre=/sbin/modprobe overlay
ExecStart=/opt/docker/bin/containerd
Restart=always
RestartSec=5
Delegate=yes
KillMode=process
OOMScoreAdjust=-999
LimitNOFILE=1048576
LimitNPROC=infinity
LimitCORE=infinity
[Install]
WantedBy=multi-user.target
EOF
cp containerd.service /etc/systemd/system/
systemctl enable containerd && systemctl restart containerd
最后
以上就是从容保温杯为你收集整理的Docker篇-源码安装docker-ce1 引言2 安装的全部内容,希望文章能够帮你解决Docker篇-源码安装docker-ce1 引言2 安装所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复