docker场景学习

https://docs.docker.com/engine/reference/commandline

1.镜像相关 以redis为例

##搜索镜像## Search the Docker Hub for images

docker search <name>

Usage:  docker search [OPTIONS] TERM
Search the Docker Hub for images
Options:
  -f, --filter filter   Filter output based on conditions provided  根据条件过滤输出
过滤标记(-f或--filter)格式为一key=value对。如果有多个过滤器,则传递多个标志(例如--filter is-automated=true --filter stars=3)

当前支持的过滤器是:The currently supported filters are:

stars (int - number of stars the image has)         星星(整数-图像具有的星星数) 
is-automated (boolean - true or false) - is the image automated or not   图像是否自动

is-official (boolean - true or false) - is the image official or not 是官方的(布尔值-正确或错误)-图片是否正式
      --format string   Pretty-print search using a Go template     根据Go模板进行漂亮的打印输出
      --limit int       Max number of search results (default 25)   最多搜索结果输,默认25。此值的范围可以是1到100。
      --no-trunc        Don't truncate output                       不要截断输出,Description显示完整的镜像描述;
$ docker search redis
NAME                             DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
redis                            Redis is an open source key-value store that…   8716                [OK]
bitnami/redis                    Bitnami Redis Docker Image                      165                                     [OK]
sameersbn/redis                                                                  82                                      [OK]
grokzen/redis-cluster            Redis cluster 3.0, 3.2, 4.0, 5.0, 6.0           72
....
镜像名称 镜像描述 点赞数 是否docker官方发布 是否自动构建(是否是dockerfile构建)

关于自动构建镜像:

自动化构建,就是使用Docker Hub连接一个包含Dockerfile文件的GitHub仓库或者BitBucket仓库,Docker Hub则会自动构建镜像,通过这种方式构建出来的镜像会被标记为Automated Build,也称之为受信构建(Trusted Build),这种构建方式构建出来的镜像,其他人在使用时可以自由的查看Dockerfile内容,知道该镜像是怎么来的,同时,由于构建过程是自动的,所以能够确保仓库中的镜像都是最新的。

##拉取镜像##

$ docker pull --help

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

Pull an image or a repository from a registry

Options:
  -a, --all-tags                Download all tagged images in the repository 下载存储库中所有标记的图像,如果未提供标签,则Docker Engine将使用该:latest标签作为默认标签。此命令将拉出debian:latest图像:
      --disable-content-trust   Skip image verification (default true) 跳过图像验证,默认true

如果未提供标签,则Docker Engine将使用该:latest标签作为默认标签。此命令将拉出debian:latest图像:

注意:

Docker images can consist of multiple layers. In the example above, the image consists of two layers; fdd5d7827f33 and a3ed95caeb02.

Layers can be reused by images. For example, the debian:jessie image shares both layers with debian:latest. Pulling the debian:jessie image therefore only pulls its metadata, but not its layers, because all layers are already present locally:

 

 

##启动镜像##

##启动镜像##

 

posted on 2020-11-04 10:27  roger888  阅读(59)  评论(0编辑  收藏  举报

导航