Containerd snippets
Basic image management with ctr
Pulling images with ctr
always requires a fully-qualified reference — in other words, you cannot omit the domain or the tag parts (the digest doesn’t have to be provided, though).
ctr image pull docker.io/library/nginx:latest
ctr image pull quay.io/quay/busybox:latest
Listing local images
ctr image ls
Tag images
ctr image tag example.com/iximiuz/test:latest localhost:5000/iximiuz/test:latest
Push images
ctr image push localhost:5000/iximiuz/test:latest
Remove images
ctr image remove localhost:5000/iximiuz/test:latest
Run containers
ctr image pull docker.io/library/hello-world:latest
ctr run docker.io/library/hello-world:latest hello1
List containers
Back to basic container operations, you can list existing containers with:
ctr container ls
Inspect container
You can also inspect a container with ctr container info <container-id>
:
Remove container
Finally, you can remove a container with ctr container remove . Let’s remove the hello1 container we’ve created earlier:
ctr container remove hello1
Nerdctl
Run command in a new container
nerdctl run
Run a command in a running container
nerdctl exec
Create a new container
nerdctl create
Fetch container logs
nerdctl logs
Start one or more running containers.
nerdctl start
Stop one or more running containers.
nerdctl stop
Restart one or more running containers.
nerdctl restart
Remove one or more containers/images.
nerdctl rm/rmi
Remove all stopped containers.
nerdctl container prune
Build an image from a Dockerfile.
nerdctl build
Pull/push an image from a registry.
nerdctl pull/push
Was this helpful?
0 / 0