zoukankan      html  css  js  c++  java
  • ctr images pull docker.io/library/redis:latest

     

    root@ubuntu:~# ctr images list | grep redis
    docker.io/library/redis:latest application/vnd.docker.distribution.manifest.list.v2+json sha256:33ca074e6019b451235735772a9c3e7216f014aae8eb0580d7e94834fe23efb3 35.1 MiB linux/386,linux/amd64,linux/arm/v5,linux/arm/v7,linux/arm64/v8,linux/mips64le,linux/ppc64le,linux/s390x -      
    root@ubuntu:~# ctr images list -q
    docker.io/library/redis:latest
    root@ubuntu:~# ctr images rm docker.io/library/redis:latest
    docker.io/library/redis:latest
    root@ubuntu:~# 

     

    containerd

    containerd is a high-level runtime that was split off from Docker. Like runc, which was broken off as the low-level runtime piece, containerd was broken off as the high-level runtime piece of Docker. containerd implements downloading images, managing them, and running containers from images. When it needs to run a container it unpacks the image into an OCI runtime bundle and shells out to runc to run it.

    Containerd also provides an API and client application that can be used to interact with it. The containerd command line client is ctr.

    ctr can be used to tell containerd to pull a container image:

    $ sudo ctr images pull docker.io/library/redis:latest
    

    List the images you have:

    $ sudo ctr images list
    

    Run a container based on an image:

    $ sudo ctr container create docker.io/library/redis:latest redis
    

    List the running containers:

    $ sudo ctr container list
    

    Stop the container:

    $ sudo ctr container delete redis
    

    These commands are similar to how a user interacts with Docker. However, in contrast with Docker, containerd is focused solely on running containers, so it does not provide a mechanism for building containers. Docker was focused on end-user and developer use cases, whereas containerd is focused on operational use cases, such as running containers on servers. Tasks such as building container images are left to other tools.

    containerd的加载方式:ctr命令方式

    在4个节点都把puase镜像加载进去

    [root@host121 data]# ctr --version
    ctr github.com/rancher/containerd v1.3.0-k3s.4 
    [root@host121 data]# ls
    pause-amd64-3.1.tar.gz
    [root@host121 data]# gunzip pause-amd64-3.1.tar.gz 
    [root@host121 data]# ls
    pause-amd64-3.1.tar
    [root@host121 data]# ctr images import pause-amd64-3.1.tar 
    unpacking gcr.io/google_containers/pause-amd64:3.1 (sha256:0968e31df05b727234888883ba43ccaa4ec75566113c75065af5a6124b62d93c)...done
    [root@host121 data]# ctr images list
    REF                                                                     TYPE                                       DIGEST                                                                  SIZE      PLATFORMS   LABELS                          
    gcr.io/google_containers/pause-amd64:3.1                                application/vnd.oci.image.manifest.v1+json sha256:0968e31df05b727234888883ba43ccaa4ec75566113c75065af5a6124b62d93c 729.0 KiB linux/amd64 io.cri-containerd.image=managed 
    sha256:da86e6ba6ca197bf6bc5e9d900febd906b133eaa4750e6bed647b0fbe50ed43e application/vnd.oci.image.manifest.v1+json sha256:0968e31df05b727234888883ba43ccaa4ec75566113c75065af5a6124b62d93c 729.0 KiB linux/amd64 io.cri-containerd.image=managed 
    [root@host121 data]# ctr images tag gcr.io/google_containers/pause-amd64:3.1 k8s.gcr.io/pause:3.1
    k8s.gcr.io/pause:3.1
    [root@host121 data]#

    确认一下,已经加载进来了

    [root@host121 data]# ctr images list
    REF                                                                     TYPE                                       DIGEST                                                                  SIZE      PLATFORMS   LABELS                          
    gcr.io/google_containers/pause-amd64:3.1                                application/vnd.oci.image.manifest.v1+json sha256:0968e31df05b727234888883ba43ccaa4ec75566113c75065af5a6124b62d93c 729.0 KiB linux/amd64 io.cri-containerd.image=managed 
    sha256:da86e6ba6ca197bf6bc5e9d900febd906b133eaa4750e6bed647b0fbe50ed43e application/vnd.oci.image.manifest.v1+json sha256:0968e31df05b727234888883ba43ccaa4ec75566113c75065af5a6124b62d93c 729.0 KiB linux/amd64 io.cri-containerd.image=managed 
    [root@host121 data]#

    但是名称还是不同,所以需要tag命令来帮助一下

    [root@host121 data]# ctr images tag gcr.io/google_containers/pause-amd64:3.1 k8s.gcr.io/pause:3.1
    k8s.gcr.io/pause:3.1
    [root@host121 data]# ctr images list
    REF                                                                     TYPE                                       DIGEST                                                                  SIZE      PLATFORMS   LABELS                          
    gcr.io/google_containers/pause-amd64:3.1                                application/vnd.oci.image.manifest.v1+json sha256:0968e31df05b727234888883ba43ccaa4ec75566113c75065af5a6124b62d93c 729.0 KiB linux/amd64 io.cri-containerd.image=managed 
    k8s.gcr.io/pause:3.1                                                    application/vnd.oci.image.manifest.v1+json sha256:0968e31df05b727234888883ba43ccaa4ec75566113c75065af5a6124b62d93c 729.0 KiB linux/amd64 io.cri-containerd.image=managed 
    sha256:da86e6ba6ca197bf6bc5e9d900febd906b133eaa4750e6bed647b0fbe50ed43e application/vnd.oci.image.manifest.v1+json sha256:0968e31df05b727234888883ba43ccaa4ec75566113c75065af5a6124b62d93c 729.0 KiB linux/amd64 io.cri-containerd.image=managed 
    [root@host121 data]# 
    

    ker的加载方式:ctr命令方式

    如果是Docker作为容器运行环境的情况,使用docker load -i命令将pause镜像加载进去即可。

    执行命令:docker load -i pause镜像名称

  • 相关阅读:
    Confluence 6 使用 WebDAV 客户端来对页面进行操作
    Confluence 6 的 WebDAV 客户端整合介绍
    Confluence 6 MySQL 3.x 字符集编码问题
    Confluence 6 € 欧元字符集不能正常显示
    Confluence 6 字符集编码的问题解决
    Confluence 6 数据库字符集编码和问题
    Confluence 6 配置字符集编码
    Confluence 6 邮件队列
    pyDay6
    c++第十六天
  • 原文地址:https://www.cnblogs.com/dream397/p/13819153.html
Copyright © 2011-2022 走看看