首页 > 系统相关 >二进制部署containerd与runc && ubuntu系统

二进制部署containerd与runc && ubuntu系统

时间:2022-11-14 18:35:51浏览次数:67  
标签:++++++++++++++++++++++++++++++++++++++ containerd runc done && ubuntu sh

二进制部署containerd与runc && ubuntu系统

coontainerd

#下载
root@ubuntu:~# wget https://github.com/containerd/containerd/releases/download/v1.6.9/containerd-1.6.9-linux-amd64.tar.gz

#解压
root@ubuntu:~# tar xf containerd-1.6.9-linux-amd64.tar.gz
#解压后会在当前目录有一个bin的目录 里面都是现成的命令

#拷贝命令
root@ubuntu:~# cp bin/* /usr/bin/

#编写containerd.service文件
root@ubuntu:~# cat /lib/systemd/system/containerd.service
[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target local-fs.target

[Service]
EnvironmentFile=-/usr/sbin/modprobe overlay
ExecStart=/usr/bin/containerd				#注意这里启动的命令位置
Type=notify
Delegate=yes
KillMode=process
Restart=always
RestartSec=5
LimitNPROC=infinity
LimitCORE=infinity
OOMScoreAdjust=-999
[Install]
WantedBy=multi-user.target

#创建containerd系统配置文件
root@ubuntu:~# mkdir /etc/containerd

#生成一个默认配置文件
root@ubuntu:~# containerd config default > /etc/containerd/config.toml

#增加这两条154,155 这是配置精选加速
root@ubuntu:~# vim /etc/containerd/config.toml
153       [plugins."io.containerd.grpc.v1.cri".registry.mirrors]
154       [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
155          endpoint = ["https://99162102.mirror.aliyuncs.com"]

#接下来启动containerd
root@ubuntu:~# systemctl restart containerd.service 
root@ubuntu:~# systemctl enable containerd.service 

#接下来就开始配置runc

runc

#下载 下来直接就是命令拷贝加权限即可
[centos@worker0 ~]$ wget https://github.com/opencontainers/runc/releases/download/v1.1.4/runc.amd64

#拷贝
root@ubuntu:~# cp runc.amd64 /usr/bin/runc

#加执行权限
root@ubuntu:~# chmod a+x /usr/bin/runc

#拉取镜像
root@ubuntu:~# ctr images pull docker.io/library/alpine:latest
docker.io/library/alpine:latest:                                                  resolved       |++++++++++++++++++++++++++++++++++++++| 
index-sha256:b95359c2505145f16c6aa384f9cc74eeff78eb36d308ca4fd902eeeb0a0b161b:    done           |++++++++++++++++++++++++++++++++++++++| 
manifest-sha256:3d426b0bfc361d6e8303f51459f17782b219dece42a1c7fe463b6014b189c86d: done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:ca7dd9ec2225f2385955c43b2379305acd51543c28cf1d4e94522b3d94cce3ce:    done           |++++++++++++++++++++++++++++++++++++++| 
config-sha256:bfe296a525011f7eb76075d688c681ca4feaad5afe3b142b36e30f1a171dc99a:   done           |++++++++++++++++++++++++++++++++++++++| 
elapsed: 70.1s                                                                    total:  1.0 Mi (14.7 KiB/s)               

#链接容器
root@ubuntu:~# ctr run -t --net-host docker.io/library/alpine:latest container1 sh
/ # 

containerd客户端工具扩展

crictl

#下载地址

root@ubuntu:~# wget https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.25.0/crictl-v1.25.0-linux-amd64.tar.gz

#拷贝命令
root@ubuntu:~# cp crictl /usr/local/bin/

#配置crictl运行环境
默认链接是 unix:///var/run/dockershim.sock
但是containerd的在以下路径 	不修改的话会报错 他找不到containerd
root@ubuntu:~# ls /run/containerd/containerd.sock
/run/containerd/containerd.sock

#修改配置文件 如果没有这个文件就创建一个
root@ubuntu:~# cat /etc/crictl.yaml
runtime-endpoint: "unix:///run/containerd/containerd.sock"
image-endpoint: "unix:///run/containerd/containerd.sock"
timeout: 10
debug: false

#下载镜像 查看镜像
root@ubuntu:~# crictl pull nginx:1.20.2
Image is up to date for sha256:50fe74b50e0d0258922495297efbb9ebc3cbd5742103df1ca54dc21c07d24575
root@ubuntu:~# crictl images list
IMAGE                     TAG                 IMAGE ID            SIZE
docker.io/library/nginx   1.20.2              50fe74b50e0d0       56.7MB

nerdctl-推荐使用

root@ubuntu:~# wget https://github.com/containerd/nerdctl/releases/download/v1.0.0/nerdctl-1.0.0-linux-amd64.tar.gz
root@ubuntu:~# tar xf nerdctl-1.0.0-linux-amd64.tar.gz
root@ubuntu:~# cp nerdctl /usr/bin/
root@ubuntu:~# nerdctl version
WARN[0000] unable to determine buildctl version: exec: "buildctl": executable file not found in $PATH 
Client:
 Version:	v1.0.0
 OS/Arch:	linux/amd64
 Git commit:	c00780a1f5b905b09812722459c54936c9e070e6
 buildctl:
  Version:	

Server:
 containerd:
  Version:	v1.6.9
  GitCommit:	1c90a442489720eec95342e1789ee8a5e1b9536f
 runc:
  Version:	1.1.1
  GitCommit:	v1.1.0-20-g52de29d7

2.21 cni-安装

root@ubuntu:~# wget https://github.com/containernetworking/plugins/releases/download/v1.1.1/cni-plugins-linux-amd64-v1.1.1.tgz
root@ubuntu:~# mkdir /opt/cni/bin -p
root@ubuntu:~# tar xf cni-plugins-linux-amd64-v1.1.1.tgz -C /opt/cni/bin/

  • nginx
#创建容器并指定端口
root@ubuntu:~# nerdctl run -d -p 80:80 --name=nginx-web1 --restart=always nginx
docker.io/library/nginx:latest:                                                   resolved       |++++++++++++++++++++++++++++++++++++++| 
index-sha256:943c25b4b66b332184d5ba6bb18234273551593016c0e0ae906bab111548239f:    done           |++++++++++++++++++++++++++++++++++++++| 
manifest-sha256:06aa2038b42f1502b59b3a862b1f5980d3478063028d8e968f0810b9b0502380: done           |++++++++++++++++++++++++++++++++++++++| 
config-sha256:76c69feac34e85768b284f84416c3546b240e8cb4f68acbbe5ad261a8b36f39f:   done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:8e3ed6a9e43aaf17bc2175fa2c7ae2ee24cff4d32bf82adf1ea689db4dcf15e1:    done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:e9995326b091af7b3ce352fad4d76cf3a3cb62b7a0c35cc5f625e8e649d23c50:    done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:71689475aec267fae8891b2b3d2bef78c6b3d57c077129ff9cd69b6e5253dfa7:    done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:f88a23025338bc64e97dc350efac90275df227949d7c835b8b1f6fbc4d2439c0:    done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:0df440342e265c89de536643c3376dadf44c810fe2fb2b2ee44711f8661ce531:    done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:eef26ceb3309d6e72a4402c3f16b047416adecaf91bc5360ebd4205d1ef5e310:    done           |++++++++++++++++++++++++++++++++++++++| 
elapsed: 30.2s                                                                    total:  54.2 M (1.8 MiB/s)                                       
e0caa4dad802b4b064ad1ff058f05b05ef58759f2016870c2888883924e7f8c6

root@ubuntu:~# nerdctl ps
CONTAINER ID    IMAGE                             COMMAND                   CREATED           STATUS    PORTS                 NAMES
e0caa4dad802    docker.io/library/nginx:latest    "/docker-entrypoint.…"    19 seconds ago    Up        0.0.0.0:80->80/tcp    nginx-web1
 
root@ubuntu:~# nerdctl exec -it nginx-web1 bash
root@e0caa4dad802:/# 


root@ubuntu:~# nerdctl run -d -p 8080:8080 --name=tomcat-web1 --restart=always tomcat:7.0.88-alpine
docker.io/library/tomcat:7.0.88-alpine:                                           resolved       |++++++++++++++++++++++++++++++++++++++| 
index-sha256:fbea9924c4e324b2eee05fbb4317d0fd768f15387f8c77a5d6ee4c4cbdc5a0bc:    done           |++++++++++++++++++++++++++++++++++++++| 
manifest-sha256:3a1bfd26628b05080841b61ce33a581b137243ef77967a86a7e0ab06148d6a8f: done           |++++++++++++++++++++++++++++++++++++++| 
config-sha256:2c15647bb9a382cf774b7906e6489e2f5491ac6e66593c6a66d6c0d61989c8f1:   done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:44e6d293805b58dc5838472788c76c025026ac2c14044d598127d06066a25d5f:    done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:911c6d0c7995e5d9763c1864d54fb6deccda04a55d7955123a8e22dd9d44c497:    done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:4001add52a901363833fa030b1451162d380a5423906a45f64e090a5ee9efb74:    done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:cbee32cff593b645ca1694f052ad0545fe5a7bfd1fdc9087624013627ddb041c:    done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:6334d5b42b354493d40f92ab8d15c307273f5ff11f70421d1bddacc91416adb8:    done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:3ae691a546b360850dc64c3f25ebab76406ea37a6abaf5a00109627dcfea839f:    done           |++++++++++++++++++++++++++++++++++++++| 
elapsed: 30.8s                                                                    total:  73.8 M (2.4 MiB/s)                                       
1594ed7c408e04b188e6454472871b01ff82b74ea654a52707c7f755964e2eee

标签:++++++++++++++++++++++++++++++++++++++,containerd,runc,done,&&,ubuntu,sh
From: https://www.cnblogs.com/yidadasre/p/16889918.html

相关文章

  • 用kubeadm安装k8s(使用containerd作为runc)
    1、从github下载下来containerdhttps://github.com/containerd/containerd/releases/tag/v1.6.8 2、解压并将文件直接复制进去/usr/local/bin/tarxvfcontainerd-1.......
  • yum安装Containerd、crictl工具
    1)安装containerd参考:https://kubernetes.io/zh-cn/docs/setup/production-environment/container-runtimes/#install-and-configure-prerequisites转发IPv4并让iptab......
  • containerd 容器
    #containerd管理操作yum-yinstalllibseccomp-develwgethttps://github.com/containerd/containerd/releases/download/v1.5.7/cri-containerd-cni-1.5.7-linux-amd64.......
  • containerd和shim通信
    containerd-shim-runc-v2启动了一个ttrpcserver(类似grpc)containerd通过ttrpc和containerd-shim-runc-v2 通信来管理容器serviceTask{ rpcState(StateReques......
  • hive的trunc函数详解
    一、日期TRUNC函数为指定元素而截去的日期值。其具体的语法格式:TRUNC(date[,fmt])其中:date一个日期值fmt日期格式,该日期将由指定的元素格式所截去。忽略它则由最......
  • Containerd部署
    containerd部署      containerd-1.6.9-linux-amd64.tar.gz 只包含containerdcri-containerd-cni-1.6.9-linux-amd64.tar.gz 包含containerd以及crirunc......
  • MySQL中Delete和Truncate区别
    一、清空表语句truncatetable[表名];deletefrom[表名]where…; 二、相同点两者都是删除表数据但不会删除表结构 三、不同点delete支持按条件删除,TRUNCA......
  • [Typescript] 71. Medium - Trunc
    Implementthetypeversionof Math.trunc,whichtakesstringornumberandreturnstheintegerpartofanumberbyremovinganyfractionaldigits.Forexample......
  • k8s将节点容器运行时从Docker迁移到Containerd
    1.执行drain操作kubectldraink8s-node01--ignore-daemonsets#2.对应节点上关闭docker#注意,是要迁移的节点systemctlstopkubeletsystemctlstopdocker.soc......
  • Typescript类型体操 - Trunc
    题目中文实现类型版本的Math.trunc,其接受一个字符串或数字作为泛型参数,并返回移除了全部小数位部分后的整数示例:typeA=Trunc<12.34>;//12EnglishImpleme......