1. 程式人生 > 實用技巧 >windows下部署containerd.exe

windows下部署containerd.exe

1. 通過github containerd專案下載最新release包

  截止目前最新windows版release包為:

  https://github.com/containerd/containerd/releases/download/v1.4.3/cri-containerd-cni-1.4.3-windows-amd64.tar.gz

2. 解壓contaienrd壓縮包

  使用7z,360壓縮之類的軟體都可以

  

  

3. 生成containerd配置檔案

  進入powershell命令列,通過命令生成配置檔案

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

4. 檢視並修改containerd配置檔案

  通過[plugins."io.containerd.grpc.v1.cri".cni]可以瞭解到containerd安裝目錄預設為"C:\Program Files\containerd"

  

  修改root和state目錄

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

  

  修改[plugins."io.containerd.internal.v1.opt"]

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

  

5. 安裝containerd

  重新命名解壓目錄為containerd,並拷貝到"C:\\Program Files"目錄下

  目錄結構:

  

  使用者變數PATH中新增containerd目錄

  

6. 啟動containerd

  啟動powershell或者cmd,執行containerd

PS C:\Users> containerd
time="2020-12-27T11:25:08.727261100+08:00" level=info msg="starting containerd" revision=269548fa27e0089a8b8278fc4fc781d7f65a939b version=v1.4.3
time="2020-12-27T11:25:08.776253900+08:00" level=info msg="loading plugin \"io.containerd.content.v1.content\"..." type=io.containerd.content.v1 time="2020-12-27T11:25:08.778255000+08:00" level=info msg="loading plugin \"io.containerd.snapshotter.v1.windows-lcow\"..." type=io.containerd.snapshotter.v1 time="2020-12-27T11:25:08.793245100+08:00" level=info msg="loading plugin \"io.containerd.snapshotter.v1.windows\"..." type=io.containerd.snapshotter.v1 time="2020-12-27T11:25:08.795221000+08:00" level=info msg="loading plugin \"io.containerd.metadata.v1.bolt\"..." type=io.containerd.metadata.v1 time="2020-12-27T11:25:08.795221000+08:00" level=info msg="metadata content store policy set" policy=shared time="2020-12-27T11:25:08.928697700+08:00" level=info msg="loading plugin \"io.containerd.differ.v1.walking\"..." type=io.containerd.differ.v1 time="2020-12-27T11:25:08.928697700+08:00" level=info msg="loading plugin \"io.containerd.gc.v1.scheduler\"..." type=io.containerd.gc.v1 time="2020-12-27T11:25:08.935673800+08:00" level=info msg="loading plugin \"io.containerd.service.v1.introspection-service\"..." type=io.containerd.service.v1 time="2020-12-27T11:25:08.935673800+08:00" level=info msg="loading plugin \"io.containerd.service.v1.containers-service\"..." type=io.containerd.service.v1 time="2020-12-27T11:25:08.935673800+08:00" level=info msg="loading plugin \"io.containerd.service.v1.content-service\"..." type=io.containerd.service.v1 time="2020-12-27T11:25:08.936671000+08:00" level=info msg="loading plugin \"io.containerd.differ.v1.windows-lcow\"..." type=io.containerd.differ.v1 time="2020-12-27T11:25:08.936671000+08:00" level=info msg="loading plugin \"io.containerd.differ.v1.windows\"..." type=io.containerd.differ.v1 time="2020-12-27T11:25:08.936671000+08:00" level=info msg="loading plugin \"io.containerd.service.v1.diff-service\"..." type=io.containerd.service.v1 time="2020-12-27T11:25:08.936671000+08:00" level=info msg="loading plugin \"io.containerd.service.v1.images-service\"..." type=io.containerd.service.v1 time="2020-12-27T11:25:08.936671000+08:00" level=info msg="loading plugin \"io.containerd.service.v1.leases-service\"..." type=io.containerd.service.v1 time="2020-12-27T11:25:08.936671000+08:00" level=info msg="loading plugin \"io.containerd.service.v1.namespaces-service\"..." type=io.containerd.service.v1 time="2020-12-27T11:25:08.937660600+08:00" level=info msg="loading plugin \"io.containerd.service.v1.snapshots-service\"..." type=io.containerd.service.v1 time="2020-12-27T11:25:08.937660600+08:00" level=info msg="loading plugin \"io.containerd.runtime.v2.task\"..." type=io.containerd.runtime.v2 time="2020-12-27T11:25:08.950724500+08:00" level=info msg="loading plugin \"io.containerd.service.v1.tasks-service\"..." type=io.containerd.service.v1 time="2020-12-27T11:25:08.952650800+08:00" level=info msg="loading plugin \"io.containerd.internal.v1.restart\"..." type=io.containerd.internal.v1 time="2020-12-27T11:25:08.982036400+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.containers\"..." type=io.containerd.grpc.v1 time="2020-12-27T11:25:08.982036400+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.content\"..." type=io.containerd.grpc.v1 time="2020-12-27T11:25:08.982961500+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.diff\"..." type=io.containerd.grpc.v1 time="2020-12-27T11:25:08.982961500+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.events\"..." type=io.containerd.grpc.v1 time="2020-12-27T11:25:08.983982700+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.healthcheck\"..." type=io.containerd.grpc.v1 time="2020-12-27T11:25:08.983982700+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.images\"..." type=io.containerd.grpc.v1 time="2020-12-27T11:25:08.983982700+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.leases\"..." type=io.containerd.grpc.v1 time="2020-12-27T11:25:08.983982700+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.namespaces\"..." type=io.containerd.grpc.v1 time="2020-12-27T11:25:08.984982300+08:00" level=info msg="loading plugin \"io.containerd.internal.v1.opt\"..." type=io.containerd.internal.v1 time="2020-12-27T11:25:08.986959400+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.snapshots\"..." type=io.containerd.grpc.v1 time="2020-12-27T11:25:08.986959400+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.tasks\"..." type=io.containerd.grpc.v1 time="2020-12-27T11:25:08.986959400+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.version\"..." type=io.containerd.grpc.v1 time="2020-12-27T11:25:08.986959400+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.cri\"..." type=io.containerd.grpc.v1 time="2020-12-27T11:25:08.987964200+08:00" level=info msg="Start cri plugin with config {PluginConfig:{ContainerdConfig:{Snapshotter:windows DefaultRuntimeName:runhcs-wcow-process DefaultRuntime:{Type: Engine: PodAnnotations:[] ContainerAnnotations:[] Root: Options:<nil> PrivilegedWithoutHostDevices:false BaseRuntimeSpec:} UntrustedWorkloadRuntime:{Type: Engine: PodAnnotations:[] ContainerAnnotations:[] Root: Options:<nil> PrivilegedWithoutHostDevices:false BaseRuntimeSpec:} Runtimes:map[runhcs-wcow-process:{Type:io.containerd.runhcs.v1 Engine: PodAnnotations:[] ContainerAnnotations:[] Root: Options:<nil> PrivilegedWithoutHostDevices:false BaseRuntimeSpec:}] NoPivot:false DisableSnapshotAnnotations:false DiscardUnpackedLayers:false} CniConfig:{NetworkPluginBinDir:C:\\Program Files\\containerd\\cni\\bin NetworkPluginConfDir:C:\\Program Files\\containerd\\cni\\conf NetworkPluginMaxConfNum:1 NetworkPluginConfTemplate:} Registry:{Mirrors:map[docker.io:{Endpoints:[https://registry-1.docker.io]}] Configs:map[] Auths:map[] Headers:map[]} ImageDecryption:{KeyModel:} DisableTCPService:true StreamServerAddress:127.0.0.1 StreamServerPort:0 StreamIdleTimeout:4h0m0s EnableSelinux:false SelinuxCategoryRange:0 SandboxImage:mcr.microsoft.com/oss/kubernetes/pause:1.4.0 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 IgnoreImageDefinedVolumes:false} ContainerdRootDir:C:\\Program Files\\containerd\\root ContainerdEndpoint:\\\\.\\pipe\\containerd-containerd RootDir:C:\\Program Files\\containerd\\root\\io.containerd.grpc.v1.cri StateDir:C:\\Program Files\\containerd\\state\\io.containerd.grpc.v1.cri}" time="2020-12-27T11:25:08.998450200+08:00" level=info msg="Connect containerd service" time="2020-12-27T11:25:09.016395900+08:00" level=info msg="Get image filesystem path \"C:\\\\Program Files\\\\containerd\\\\root\\\\io.containerd.snapshotter.v1.windows\"" time="2020-12-27T11:25:09.036063400+08:00" level=info msg="Start subscribing containerd event" time="2020-12-27T11:25:09.036800700+08:00" level=info msg="loading plugin \"io.containerd.grpc.v1.introspection\"..." type=io.containerd.grpc.v1 time="2020-12-27T11:25:09.078592000+08:00" level=info msg=serving... address="\\\\.\\pipe\\containerd-containerd.ttrpc" time="2020-12-27T11:25:09.079562400+08:00" level=info msg=serving... address="\\\\.\\pipe\\containerd-containerd" time="2020-12-27T11:25:09.080561900+08:00" level=info msg="containerd successfully booted in 0.355301s" time="2020-12-27T11:25:09.093553900+08:00" level=info msg="Start recovering state" time="2020-12-27T11:25:09.112853000+08:00" level=info msg="Start event monitor" time="2020-12-27T11:25:09.113851500+08:00" level=info msg="Start snapshots syncer" time="2020-12-27T11:25:09.113851500+08:00" level=info msg="Start cni network conf syncer" time="2020-12-27T11:25:09.113851500+08:00" level=info msg="Start streaming server"

  另開一個終端執行containerd客戶端命令ctr,測試containerd服務

  

  大功告成!