best practise
change containerd’s default data path
Identify the Current Data Path
1
| containerd config default | grep "root" # Expected output: root = "/var/lib/containerd"
|
Modify the following lines in /etc/containerd/config.toml:
1
| root = "/path/to/new/data/path" # the location where container data (images, volumes) is stored
|
Move Existing Data (if required)
1 2 3
| sudo systemctl stop containerd # optional sudo mv /var/lib/containerd /data/containerd sudo systemctl start containerd
|
command
image
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| # list k8s image sudo ctr -n k8s.io images ls
# pull k8s image sudo ctr -n k8s.io images pull xxx # pull with auth sudo ctr images pull --user username:password registry.example.com/repository/image:tag
# load tar file sudo ctr -n k8s.io images import /tmp/my-image.tar # combine load tar file to specify tag image sudo ctr -n k8s.io images import --base-name my.registry.com/myproject/my-image:v1.2.3 /path/to/image.tar
# rename tag sudo ctr -n k8s.io images tag <old-image-name> <new-image-name>
# remove image sudo ctr -n k8s.io images remove <name>:<tag>
|