























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).
Try the following command to pull the latest nginx image from Docker Hub:
sudo ctr image pull docker.io/library/nginx:latest
And here is how you can pull an image from another registry - in this case, from Quay:
sudo ctr image pull quay.io/quay/busybox:latest
Listing local images with ctr is pretty straightforward:
However, despite the fact the containerd is often used by higher-level tools to build container images, it doesn't provide out-of-the-box image building functionality, so there's no ctr image build command.
Luckily, you can load existing images into containerd using ctr image import.
To some extent, it can mitigate the absence of the build command.
Here is how you can build an image using a traditional docker build command and then import it:
docker build -t example.com/iximiuz/test:latest --sbom=false --provenance=false - <<EOF
FROM busybox:latest
CMD ["echo", "just a test"]
EOF
docker save -o iximiuz-test.tar example.com/iximiuz/test:latest
sudo ctr image import iximiuz-test.tar
Much like in Docker, you can tag local images with ctr image tag.
For instance:
sudo ctr image tag example.com/iximiuz/test:latest \
registry.iximiuz.com/test:latest
How about pushing this image to a remote registry?
Conveniently, the playground has an ephemeral registry available at registry.iximiuz.com.
This registry is configured to use basic authentication,
and since there is no docker login equivalent in ctr,
you'll need to provide the --user <user>:<pass> flag to authenticate with it:
sudo ctr image push --user iximiuzlabs:rules! registry.iximiuz.com/test:latest
To remove the (local) image, you can use the ctr image remove command:
sudo ctr image remove registry.iximiuz.com/test:latest
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。