Hello,
I'm sure this will be a question that comes up a lot as Kubernetes uses switch away from Docker and to just containerd. Most documentation references crictl for interacting with container runtimes, and I had been used to using that after leaving the docker cli. However, just recently I noticed that ctr was there and ships with containerd. Why use crictl when there's ctr, I thought?
Well, the first problem I see, that must simply be a misconfiguration on my end, is that while crictl properly lists images and pods, ctr gives me nothing. All while talking to the same containerd socket.
cat /etc/crictl.yaml
runtime-endpoint: unix:///run/containerd/containerd.sock
image-endpoint: unix:///run/containerd/containerd.sock
timeout: 10
debug: true
crictl version
DEBU[0000] VersionRequest: &VersionRequest{Version:v1alpha2,}
DEBU[0000] VersionResponse: &VersionResponse{Version:0.1.0,RuntimeName:containerd,RuntimeVersion:v1.4.1,RuntimeApiVersion:v1alpha2,}
Version: 0.1.0
RuntimeName: containerd
RuntimeVersion: v1.4.1
RuntimeApiVersion: v1alpha2
/opt/bin/ctr version
Client:
Version: v1.4.1
Revision: c623d1b36f09f8ef6536a057bd658b3aa8632828
Go version: go1.13.15
Server:
Version: v1.4.1
Revision: c623d1b36f09f8ef6536a057bd658b3aa8632828
UUID: 3afdd32d-747d-4ef3-b051-41922ff6afb0
ctr says the default socket location is, correctly: /run/containerd/containerd.sock
But doing a simple image list with ctr returns:
/opt/bin/ctr images ls
REF TYPE DIGEST SIZE PLATFORMS LABELS
But yet with crictl:
crictl images
DEBU[0000] <...snip>
IMAGE TAG IMAGE ID SIZE
<...snip>
Having no experience with ctr prior to this, I'm thinking something is misconfigured for it, but I'm not sure what? Also, interesting that ctr supports listing containers, but crictl only supports listing by pods, so it's of note that they don't seem to provide the same functionality.
Thanks,
Justin