Here is a list of command examples for working with crictl:
List all containers:
$ crictl ps
Inspect a container:
$ crictl inspect my-container
Run a container:
$ crictl run docker.io/library/nginx:latest
Attach a shell to a running container:
$ crictl exec -it my-container sh
Stop a running container:
$ crictl stop my-container
Remove a container:
$ crictl rm my-container
Pull an image:
$ crictl pull docker.io/library/nginx:latest
Remove an image:
$ crictl image rm docker.io/library/nginx:latest
Here are some more advanced command examples:
List all images:
$ crictl images
Inspect an image:
$ crictl inspecti docker.io/library/nginx:latest
Start a container with a specific network:
$ crictl run --network bridge docker.io/library/nginx:latest
Start a container with a specific volume mount:
$ crictl run --mount type=bind,source=/host/path,target=/container/path docker.io/library/nginx:latest
Execute a command in a running container and stream the output to the terminal:
$ crictl logs -f my-container
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I am working at Cotocus. I blog tech insights at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at I reviewed , and SEO strategies at Wizbrand.
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at PINTEREST
Rajesh Kumar at QUORA
Rajesh Kumar at WIZBRAND