基于Docker的容器运行时,CRI-Dockerd

Docker CE

Dokcer

Dokcer 安装及配置 dockers安装

CRI-Dokcerd

GitHub - Mirantis/cri-dockerd: dockerd as a compliant Container Runtime Interface for Kubernetes

二进制安装

# 下载
release=0.3.11
wget -c https://mirror.ghproxy.com/https://github.com/Mirantis/cri-dockerd/releases/download/v${release}/cri-dockerd-${release}.amd64.tgz
# 解压
#tar -xf cri-dockerd-${release}.amd64.tgz -C /usr/bin/ --strip-components=1
#chmod +x /usr/bin/cri-dockerd
tar -xf cri-dockerd-${release}.amd64.tgz
install -o root -g root -m 0755 cri-dockerd /usr/bin/cri-dockerd
# 可检查应用所属用户群组
ll /usr/bin/cri-dockerd

服务配置

服务文件在仓库文件中 cri-dockerd/packaging/systemd

  • service 文件

    cat > /etc/systemd/system/cri-docker.service<<"EOF"
    [Unit]
    Description=CRI Interface for Docker Application Container Engine
    Documentation=https://docs.mirantis.com
    After=network-online.target firewalld.service docker.service
    Wants=network-online.target
    Requires=cri-docker.socket
    
    [Service]
    Type=notify
    ExecStart=/usr/bin/cri-dockerd --container-runtime-endpoint fd:// --pod-infra-container-image=registry.aliyuncs.com/google_containers/pause:3.9
    ExecReload=/bin/kill -s HUP $MAINPID
    TimeoutSec=0
    RestartSec=2
    Restart=always
    StartLimitBurst=3
    StartLimitInterval=60s
    LimitNOFILE=infinity
    LimitNPROC=infinity
    LimitCORE=infinity
    TasksMax=infinity
    Delegate=yes
    KillMode=process
    
    [Install]
    WantedBy=multi-user.target
    EOF
    

    默认 execstart /usr/bin/cri-dockerd --container-runtime-endpoint fd://​ 因为网络原因,这里指定阿里云加速

  • socket 文件

    cat > /etc/systemd/system/cri-docker.socket <<"EOF"
    [Unit]
    Description=CRI Docker Socket for the API
    PartOf=cri-docker.service
    
    [Socket]
    ListenStream=%t/cri-dockerd.sock
    SocketMode=0660
    SocketUser=root
    SocketGroup=docker
    
    [Install]
    WantedBy=sockets.target
    EOF
    

加载服务

systemctl daemon-reload
systemctl start docker.service
systemctl enable cri-docker
systemctl status docker.service

posted @ 2024-03-27 00:41  虫祇  阅读(142)  评论(0编辑  收藏  举报