windows安装containerd

windows安装containerd

下载地址:containerd的GitHub发布地址

Containerd GitHub上提供了两种类型的压缩包,containerd-${VERSION}.${OS}-${ARCH}.tar.gz不包含依赖包,cri-containerd-cni-${VERSION}.${OS}-${ARCH}.tar.gz包含相关依赖的压缩包,由于 containerd 需要调用 runc,所以我们也需要先安装 runc,所以还是下载cri-containerd-cni-${VERSION}.${OS}-${ARCH}.tar.gz类型的包。

1.通过github下载解压containerd 并重命名文件夹为containerd

image-20220405205022326

2.生成containerd配置文件

.\containerd.exe config default | Out-File config.toml -Encoding ascii

image-20220405210103278

3查看并修改config.toml配置文件

打开config.toml文件

查看生成的安装路径

找到[plugins."io.containerd.grpc.v1.cri".cni]可以看到本次生成的安装目录为"D:\\Program Files\\containerd"

image-20220405210836644

存储配置

contaierd有两个不同的存储路径,其中root用来持久化数据,而state则是用来保存容器的运行时状态
修改root和state目录:

root = "D:\\Program Files\\containerd\\root"
state = "D:\\Program Files\\containerd\\state"

image-20220405211531452

修改path目录

找到[plugins."io.containerd.internal.v1.opt"]将path修改为

path = "D:\\Program Files\\containerd\\root\\opt"

image-20220405213004550

安装运行containerd

先将containerd文件移动到D:\Program Files

根据自己config.toml生成的默认安装路径移动,我的生成的径在“D:\Program Files”下

修改系统path变量

将containerd目录位置添加到path

image-20220405220229446

运行continerd

终端(dos)运行:

containerd
C:\Users\16692>containerd
time="2022-04-05T22:18:55.268261200+08:00" level=info msg="starting containerd" revision=de8046a5501db9e0e478e1c10cbcfb21af4c6b2d version=v1.6.2
time="2022-04-05T22:18:55.301132600+08:00" level=info msg="loading plugin \"io.containerd.content.v1.content\"..." type=io.containerd.content.v1
time="2022-04-05T22:18:55.301643600+08:00" level=warning msg="failed to load plugin io.containerd.content.v1.content" error="mkdir D:\\Program Files\\containerd\\root\\io.containerd.content.v1.content: Access is denied."
time="2022-04-05T22:18:55.302153600+08:00" level=info msg="loading plugin \"io.containerd.snapshotter.v1.windows-lcow\"..." type=io.containerd.snapshotter.v1
time="2022-04-05T22:18:55.302229900+08:00" level=warning msg="failed to load plugin io.containerd.snapshotter.v1.windows-lcow" error="mkdir D:\\Program Files\\containerd\\root\\io.containerd.snapshotter.v1.windows-lcow: Access is denied."
time="2022-04-05T22:18:55.302229900+08:00" level=info msg="loading plugin \"io.containerd.snapshotter.v1.windows\"..." type=io.containerd.snapshotter.v1
time="2022-04-05T22:18:55.302741900+08:00" level=warning msg="failed to load plugin io.containerd.snapshotter.v1.windows" error="mkdir D:\\Program Files\\containerd\\root\\io.containerd.snapshotter.v1.windows: Access is denied."
time="2022-04-05T22:18:55.302741900+08:00" level=info msg="loading plugin \"io.containerd.metadata.v1.bolt\"..." type=io.containerd.metadata.v1
time="2022-04-05T22:18:55.303327500+08:00" level=warning msg="failed to load plugin io.containerd.metadata.v1.bolt" error="mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.303327500+08:00" level=info msg="loading plugin \"io.containerd.differ.v1.walking\"..." type=io.containerd.differ.v1
time="2022-04-05T22:18:55.303327500+08:00" level=warning msg="failed to load plugin io.containerd.differ.v1.walking" error="mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.303327500+08:00" level=info msg="loading plugin \"io.containerd.event.v1.exchange\"..." type=io.containerd.event.v1
time="2022-04-05T22:18:55.303327500+08:00" level=info msg="loading plugin \"io.containerd.gc.v1.scheduler\"..." type=io.containerd.gc.v1
time="2022-04-05T22:18:55.303327500+08:00" level=warning msg="failed to load plugin io.containerd.gc.v1.scheduler" error="mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.303838100+08:00" level=info msg="loading plugin \"io.containerd.service.v1.introspection-service\"..." type=io.containerd.service.v1
time="2022-04-05T22:18:55.304346700+08:00" level=info msg="loading plugin \"io.containerd.service.v1.containers-service\"..." type=io.containerd.service.v1
time="2022-04-05T22:18:55.304346700+08:00" level=warning msg="failed to load plugin io.containerd.service.v1.containers-service" error="mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.304346700+08:00" level=info msg="loading plugin \"io.containerd.service.v1.content-service\"..." type=io.containerd.service.v1
time="2022-04-05T22:18:55.304860100+08:00" level=warning msg="failed to load plugin io.containerd.service.v1.content-service" error="mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.304860100+08:00" level=info msg="loading plugin \"io.containerd.differ.v1.windows-lcow\"..." type=io.containerd.differ.v1
time="2022-04-05T22:18:55.304860100+08:00" level=warning msg="failed to load plugin io.containerd.differ.v1.windows-lcow" error="mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.305377500+08:00" level=info msg="loading plugin \"io.containerd.differ.v1.windows\"..." type=io.containerd.differ.v1
time="2022-04-05T22:18:55.305377500+08:00" level=warning msg="failed to load plugin io.containerd.differ.v1.windows" error="mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.305377500+08:00" level=info msg="loading plugin \"io.containerd.service.v1.diff-service\"..." type=io.containerd.service.v1
time="2022-04-05T22:18:55.305377500+08:00" level=warning msg="failed to load plugin io.containerd.service.v1.diff-service" error="could not load required differ due plugin init error: windows: mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.305377500+08:00" level=info msg="loading plugin \"io.containerd.service.v1.images-service\"..." type=io.containerd.service.v1
time="2022-04-05T22:18:55.305377500+08:00" level=warning msg="failed to load plugin io.containerd.service.v1.images-service" error="mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.306637700+08:00" level=info msg="loading plugin \"io.containerd.service.v1.leases-service\"..." type=io.containerd.service.v1
time="2022-04-05T22:18:55.308973600+08:00" level=warning msg="failed to load plugin io.containerd.service.v1.leases-service" error="mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.308973600+08:00" level=info msg="loading plugin \"io.containerd.service.v1.namespaces-service\"..." type=io.containerd.service.v1
time="2022-04-05T22:18:55.308973600+08:00" level=warning msg="failed to load plugin io.containerd.service.v1.namespaces-service" error="mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.308973600+08:00" level=info msg="loading plugin \"io.containerd.service.v1.snapshots-service\"..." type=io.containerd.service.v1
time="2022-04-05T22:18:55.309968200+08:00" level=warning msg="failed to load plugin io.containerd.service.v1.snapshots-service" error="mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.309968200+08:00" level=info msg="loading plugin \"io.containerd.runtime.v2.task\"..." type=io.containerd.runtime.v2
time="2022-04-05T22:18:55.309968200+08:00" level=warning msg="failed to load plugin io.containerd.runtime.v2.task" error="mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.309968200+08:00" level=info msg="loading plugin \"io.containerd.service.v1.tasks-service\"..." type=io.containerd.service.v1
time="2022-04-05T22:18:55.309968200+08:00" level=warning msg="failed to load plugin io.containerd.service.v1.tasks-service" error="mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.309968200+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.introspection\"..." type=io.containerd.grpc.v1
time="2022-04-05T22:18:55.310967500+08:00" level=info msg="loading plugin \"io.containerd.internal.v1.restart\"..." type=io.containerd.internal.v1
time="2022-04-05T22:18:55.310967500+08:00" level=warning msg="failed to load plugin io.containerd.internal.v1.restart" error="failed to get instance of service \"content-service\": mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.310967500+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.containers\"..." type=io.containerd.grpc.v1
time="2022-04-05T22:18:55.310967500+08:00" level=warning msg="failed to load plugin io.containerd.grpc.v1.containers" error="mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.310967500+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.content\"..." type=io.containerd.grpc.v1
time="2022-04-05T22:18:55.310967500+08:00" level=warning msg="failed to load plugin io.containerd.grpc.v1.content" error="mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.310967500+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.diff\"..." type=io.containerd.grpc.v1
time="2022-04-05T22:18:55.311967500+08:00" level=warning msg="failed to load plugin io.containerd.grpc.v1.diff" error="could not load required differ due plugin init error: windows: mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.311967500+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.events\"..." type=io.containerd.grpc.v1
time="2022-04-05T22:18:55.311967500+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.healthcheck\"..." type=io.containerd.grpc.v1
time="2022-04-05T22:18:55.311967500+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.images\"..." type=io.containerd.grpc.v1
time="2022-04-05T22:18:55.311967500+08:00" level=warning msg="failed to load plugin io.containerd.grpc.v1.images" error="mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.312969000+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.leases\"..." type=io.containerd.grpc.v1
time="2022-04-05T22:18:55.312969000+08:00" level=warning msg="failed to load plugin io.containerd.grpc.v1.leases" error="mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.312969000+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.namespaces\"..." type=io.containerd.grpc.v1
time="2022-04-05T22:18:55.312969000+08:00" level=warning msg="failed to load plugin io.containerd.grpc.v1.namespaces" error="mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.312969000+08:00" level=info msg="loading plugin \"io.containerd.internal.v1.opt\"..." type=io.containerd.internal.v1
time="2022-04-05T22:18:55.313968800+08:00" level=warning msg="failed to load plugin io.containerd.internal.v1.opt" error="mkdir D:\\Program Files\\containerd\\root\\opt: Access is denied."
time="2022-04-05T22:18:55.313968800+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.snapshots\"..." type=io.containerd.grpc.v1
time="2022-04-05T22:18:55.313968800+08:00" level=warning msg="failed to load plugin io.containerd.grpc.v1.snapshots" error="mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.313968800+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.tasks\"..." type=io.containerd.grpc.v1
time="2022-04-05T22:18:55.314968300+08:00" level=warning msg="failed to load plugin io.containerd.grpc.v1.tasks" error="mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.314968300+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.version\"..." type=io.containerd.grpc.v1
time="2022-04-05T22:18:55.314968300+08:00" level=info msg="loading plugin \"io.containerd.tracing.processor.v1.otlp\"..." type=io.containerd.tracing.processor.v1
time="2022-04-05T22:18:55.315492800+08:00" level=info msg="skip loading plugin \"io.containerd.tracing.processor.v1.otlp\"..." error="no OpenTelemetry endpoint: skip plugin" type=io.containerd.tracing.processor.v1
time="2022-04-05T22:18:55.315492800+08:00" level=info msg="loading plugin \"io.containerd.internal.v1.tracing\"..." type=io.containerd.internal.v1
time="2022-04-05T22:18:55.315492800+08:00" level=error msg="failed to initialize a tracing processor \"otlp\"" error="no OpenTelemetry endpoint: skip plugin"
time="2022-04-05T22:18:55.315492800+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.cri\"..." type=io.containerd.grpc.v1
time="2022-04-05T22:18:55.315492800+08:00" level=info msg="Start cri plugin with config {PluginConfig:{ContainerdConfig:{Snapshotter:windows DefaultRuntimeName:runhcs-wcow-process DefaultRuntime:{Type: Path: Engine: PodAnnotations:[] ContainerAnnotations:[] Root: Options:map[] PrivilegedWithoutHostDevices:false BaseRuntimeSpec: NetworkPluginConfDir: NetworkPluginMaxConfNum:0} UntrustedWorkloadRuntime:{Type: Path: Engine: PodAnnotations:[] ContainerAnnotations:[] Root: Options:map[] PrivilegedWithoutHostDevices:false BaseRuntimeSpec: NetworkPluginConfDir: NetworkPluginMaxConfNum:0} Runtimes:map[runhcs-wcow-process:{Type:io.containerd.runhcs.v1 Path: Engine: PodAnnotations:[] ContainerAnnotations:[] Root: Options:map[] PrivilegedWithoutHostDevices:false BaseRuntimeSpec: NetworkPluginConfDir: NetworkPluginMaxConfNum:0}] NoPivot:false DisableSnapshotAnnotations:false DiscardUnpackedLayers:false IgnoreRdtNotEnabledErrors:false} CniConfig:{NetworkPluginBinDir:D:\\Program Files\\containerd\\cni\\bin NetworkPluginConfDir:D:\\Program Files\\containerd\\cni\\conf NetworkPluginMaxConfNum:1 NetworkPluginConfTemplate: IPPreference:} Registry:{ConfigPath: Mirrors:map[] Configs:map[] Auths:map[] Headers:map[]} ImageDecryption:{KeyModel:node} DisableTCPService:true StreamServerAddress:127.0.0.1 StreamServerPort:0 StreamIdleTimeout:4h0m0s EnableSelinux:false SelinuxCategoryRange:0 SandboxImage:k8s.gcr.io/pause:3.6 StatsCollectPeriod:10 SystemdCgroup:false EnableTLSStreaming:false X509KeyPairStreaming:{TLSCertFile: TLSKeyFile:} MaxContainerLogLineSize:16384 DisableCgroup:false DisableApparmor:false RestrictOOMScoreAdj:false MaxConcurrentDownloads:3 DisableProcMount:false UnsetSeccompProfile: TolerateMissingHugetlbController:false DisableHugetlbController:false DeviceOwnershipFromSecurityContext:false IgnoreImageDefinedVolumes:false NetNSMountsUnderStateDir:false EnableUnprivilegedPorts:false EnableUnprivilegedICMP:false} ContainerdRootDir:D:\\Program Files\\containerd\\root ContainerdEndpoint:\\\\.\\pipe\\containerd-containerd RootDir:D:\\Program Files\\containerd\\root\\io.containerd.grpc.v1.cri StateDir:D:\\Program Files\\containerd\\state\\io.containerd.grpc.v1.cri}"
time="2022-04-05T22:18:55.316490200+08:00" level=warning msg="failed to load plugin io.containerd.grpc.v1.cri" error="failed to get services: failed to get instance of service \"content-service\": mkdir D:\\Program Files\\containerd\\root\\io.containerd.metadata.v1.bolt: Access is denied."
time="2022-04-05T22:18:55.316490200+08:00" level=info msg=serving... address="\\\\.\\pipe\\containerd-containerd.ttrpc"
time="2022-04-05T22:18:55.316490200+08:00" level=info msg=serving... address="\\\\.\\pipe\\containerd-containerd"
time="2022-04-05T22:18:55.316490200+08:00" level=info msg="containerd successfully booted in 0.051229s"

此时的目录结构

PS D:\Program Files\containerd> ls

    目录: D:\Program Files\containerd


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         2022/3/24     10:32                cni
d-----          2022/4/5     22:18                root
d-----          2022/4/5     22:18                state
-a----          2022/4/5     21:31           6330 config.toml
-a----         2022/3/24     10:32       17030656 containerd-shim-runhcs-v1.exe
-a----         2022/3/24     10:32       17186304 containerd-stress.exe
-a----         2022/3/24     10:32       36540928 containerd.exe
-a----         2022/3/24     10:32       17884160 ctr.exe```

另开一个终端运行containerd客户端命令ctr,测试containerd服务

终端(dos)运行:

ctr version

image-20220405223340285 运行成功

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值