| docker | ctr | crictl |
|---|---|---|
| docker version | ctr version | crictl version |
| docker images | ctr i Is | crictl img |
| docker pull nginx:latest | ctr i pull docker.io/library/nginx:latest | crictl pull docker.io/library/redis |
| docker run -d –name nginx-name nginx:latest | ctr run -d docker.io/library/nginx:latest nginx-name | crictl run [command options] container-config. [json yaml] pod-config. [json yaml] |
| docker ps | ctr c Is / ctr t Is | crictl ps |
| docker inspect nginx-name | ctr c info nginx-name | crictl inspect |
| docker stop nginx-name | ctr t kill nginx-name | crictl stop |
| docker start nginx-name | crictl start | |
| docker rm nginx-name | ctr c rm nginx-name | |
| docker exec -it nginx-name bash | ctr t exec -t --exec-id="foo" nginx-name sh |
ctr有命名空间的概念,默认的ns是default。docker创建的默认在moby命名空间,k8s默认是k8s.io命名空间。不同空间的容器互相隔离。
crictl是k8s社区专门为使用containerd而制作的 https://github.com/kubernetes-sigs/cri-tools 。 其他非k8s创建的容器,crictl是无法看到和调试的, 也就是说用ctr run 运行的容器无法使用crictl 看到。