- 查看版本
[root@k8s-image ~]# ctr version
Client:
Version: v1.5.4
Revision: 69107e47a62e1d690afa2b9b1d43f8ece3ff4483
Go version: go1.16.6
Server:
Version: v1.5.4
Revision: 69107e47a62e1d690afa2b9b1d43f8ece3ff4483
UUID: c1159e3c-61a7-4d75-81a7-e9773e01800b
- 创建namespace
[root@k8s-image ~]# ctr ns create jwdlh
[root@k8s-image ~]# ctr ns ls
NAME LABELS
default
jwdlh
- 拉镜像
[root@k8s-image ~]# ctr -n jwdlh i pull docker.io/library/nginx:latest
[root@k8s-image ~]# ctr -n jwdlh i ls
REF TYPE DIGEST SIZE PLATFORMS LABELS
docker.io/library/nginx:latest application/vnd.docker.distribution.manifest.list.v2+json sha256:0d17b565c37bcbd895e9d92315a05c1c3c9a29f762b011a10c54a66cd53c9b31 54.1 MiB linux/386,linux/amd64,linux/arm/v5,linux/arm/v7,linux/arm64/v8,linux/mips64le,linux/ppc64le,linux/s390x -
- 启动容器并查看
[root@k8s-image ~]# ctr -n jwdlh run -d docker.io/library/nginx:latest nginx-7
[root@k8s-image ~]#
[root@k8s-image ~]# ctr -n jwdlh i ls
REF TYPE DIGEST SIZE PLATFORMS LABELS
docker.io/library/nginx:latest application/vnd.docker.distribution.manifest.list.v2+json sha256:0d17b565c37bcbd895e9d92315a05c1c3c9a29f762b011a10c54a66cd53c9b31 54.1 MiB linux/386,linux/amd64,linux/arm/v5,linux/arm/v7,linux/arm64/v8,linux/mips64le,linux/ppc64le,linux/s390x -
[root@k8s-image ~]#
[root@k8s-image ~]# ctr -n jwdlh c ls
CONTAINER IMAGE RUNTIME
nginx-7 docker.io/library/nginx:latest io.containerd.runc.v2
[root@k8s-image ~]# ctr -n jwdlh t ls
TASK PID STATUS
nginx-7 27131 RUNNING
- ctr run这个命令相当于做了两个步骤
(1)ctr c create
(2)ctr t start
Post Views: 1,004