CKA note finishing (2)

Preamble:

In different namespaces, the operations performed are mutually invisible and independent of each other.

Take containerd as an example, assuming that there are three namespaces: default, k8s.io, and other. Make the client nerdctl access default and crictl access k8s.io. What nerdctl does in default, crictl cannot be seen in k8s.io. k8s is equivalent to a client like nerdctl.

If you want to make nerdctl visible to the content of k8s.io, you need to add nerdctl to the namespace k8s.io. Add k8s to the namespace k8s.io of containerd, and the original namespace of k8s will correspond to k8s.io, which is equivalent to the subdirectory of k8s.io.

nerdctl cannot complete subcommands, you need to edit .bashrc

Addition source <(nerdctl completion bash)

 Then save and exit and execute source .bashrc

1. Mirror image management

view mirror

docker images
crictl images
nerdctl images

pull image

docker pull xxx
#(xxx镜像名)
nerdctl pull xxx

The namespace of nerdctl can be modified in /etc/nerdctl/nerdctl.toml

The format of nerdctl displaying images in other namespaces is unfriendly and may contain errors.

search mirror

docker serach xxx
老版本的nerdctl中不支持搜索镜像,新版本未知。

How to name the image:

Warehouse address/category/mirror name: tag

If the warehouse address is not written, it will default to docker.io; if the category is not written, it will default to library; if the tag is not written, it will default to latest

docker.io/library/nginx:latest
#完整镜像名

Images can be pulled using the full image name

Image tagging (renaming)

nerdctl tag 镜像名 重命名
#docker同上

 As long as there is a name between the two, the file exists, and there is no dependency relationship between the two.

delete mirror

docker rmi xxx
nerdctl rmi xxx

export image

nerdctl save 镜像名 > 包名(镜像名.tar)
#docker同上

 import image

nerdctl load -i xxx.tar
#docker同上

 

Guess you like

Origin blog.csdn.net/qq_52676760/article/details/128798553