Crictl usage
Install
1# ubuntu debain and other debain base distribution
2sudo apt install crictl -y
3# centos fedora and other red hat base distribution
4sudo yum install crictl -y
You can download directly from github release page
Create /etc/crictl.yaml
1runtime-endpoint: "unix:///run/containerd/containerd.sock"
2image-endpoint: ""
3timeout: 0
4debug: false
5pull-image-on-create: false
6disable-pull-on-run: false
Create pod config pod-config.yaml
1metadata:
2 attempt: 1
3 name: nginx-sandbox
4 namespace: default
5 uid: hdishd83djaidwnduwk28bcsb
6log_directory: /tmp
7linux:
8 namespaces:
9 options: {}
Create container config container-config.yaml
1metadata:
2 name: nginx
3image:
4 image: docker.io/nginx:alpine
5log_path: nginx.log
1crictl run container-config.json pod-config.json
2crictl ps -a
3#CONTAINER IMAGE CREATED STATE NAME ATTEMPT POD ID POD
4#86f1c7a2aaffe nginx 23 minutes ago Running nginx 0 dd6d7d4ea70cd unknown
5crictl start 86f1c7a2aaffe
6crictl ps
7crictl pods
8#POD ID CREATED STATE NAME NAMESPACE ATTEMPT RUNTIME
9#dd6d7d4ea70cd About an hour ago Ready nginx default 1 (default)
10crictl port-forward dd6d7d4ea70cd 80:80
11curl localhost
12#welcome to nginx