docker基础:镜像仓库相关命令

Blog:博客园 个人

镜像仓库相关

  • docker login: 登陆到一个Docker镜像仓库,如果未指定镜像仓库地址,默认为官方仓库Docker Hub
  • docker logout: 登出一个Docker镜像仓库,如果未指定镜像仓库地址,默认为官方仓库Docker Hub
  • docker pull: 从镜像仓库中拉取或者更新指定镜像;
  • docker push: 将本地的镜像上传到镜像仓库, 要先登陆到镜像仓库;
  • docker search: 从Docker Hub查找镜像;

登录镜像仓库

语法如下:

docker login [OPTIONS] [SERVER]

Options:
  -p, --password string   Password
  -u, --username string   Username

登出镜像仓库

语法如下:

docker logout [SERVER]

拉取镜像

语法如下:

docker pull [OPTIONS] NAME[:TAG|@DIGEST]

Options:
  -a, --all-tags                Download all tagged images in the repository(拉取所有tag)
      --disable-content-trust   Skip image verification (default true)(忽略校检,默认开启)

上传镜像

语法如下:

docker push [OPTIONS] NAME[:TAG]

Options:
      --disable-content-trust   Skip image verification (default true)

查找镜像

语法如下:

docker search [OPTIONS] TERM

OPTIONS
       -f, --filter=[]
          Filter output based on these conditions:
          - stars=<numberOfStar>
          - is-automated=(true|false)
          - is-official=(true|false)

       --limit=LIMIT
         Maximum returned search results. The default is 25.

       --no-trunc=true|false
          Don't truncate output. The default is false.
       -s  列出收藏数小于指定值的镜像。

例如:

[root@test ~]# docker search --limit=5 jdk
INDEX       NAME                                    DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
docker.io   docker.io/primetoninc/jdk               Oracle jdk 1.8, 1.7                             16                   [OK]
docker.io   docker.io/codenvy/jdk8_maven3_tomcat8   JDK 8, Maven 3, Tomcat 8                        7                    [OK]
docker.io   docker.io/codenvy/jdk7_tomcat7          Dockerfile https://github.com/codenvy/dock...   6
docker.io   docker.io/ascdc/jdk8                    jdk8                                            3                    [OK]
docker.io   docker.io/ringcentral/jdk               an alpine Linux image included glibc and O...   0
[root@test ~]# docker search -s 5 jdk
Flag --stars has been deprecated, use --filter=stars=3 instead
INDEX       NAME                                    DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
docker.io   docker.io/primetoninc/jdk               Oracle jdk 1.8, 1.7                             16                   [OK]
docker.io   docker.io/codenvy/jdk8_maven3_tomcat8   JDK 8, Maven 3, Tomcat 8                        7                    [OK]
docker.io   docker.io/codenvy/jdk7_tomcat7          Dockerfile https://github.com/codenvy/dock...   6
docker.io   docker.io/gmaslowski/jdk                Oracle JDK8  
posted @ 2020-07-11 08:35  不羁的罗恩  阅读(721)  评论(0编辑  收藏  举报