Docker use of mirrored pull, query, delete

1: View a list of mirrors

2: Mirror Pull

   You can pull the mirror image from the repository the command, from the default Docker Hub acquired.

   Format:

   docker image pull <repository>:<tag>

 

  Pulling ubuntu warehouse, the latest image for the label, if the label is omitted, the docker will pull tab to the latest image. Gets Unofficial mirrored a similar command, for example:

  docker image pull microsoft/dotnet:latest  

  docker image pull -a nigelpoulton / tu-demo // add -a parameter repository can pull all mirrors

3 : Docker LS Detailed Image

     docker image ls --filter [dangling|before|since|lable|reference]

     dangling: value of true or false, true only returns suspended virtual image, false returns only non-suspended virtual image. Suspended Virtual Mirror: means no label image.

 

  before: the need or mirror image name ID as a parameter and returns all mirrors created earlier.

 

since: need a mirror image name or ID as an argument, all mirrors created after return.

lable: filter by label name or value. slightly

reference: According repository and tag search, looks like a mirror * can only search space

4 : Search Mirror

 Filter by official or unofficial, use --filter "is-official = true | false"

 docker search ubuntu --filter "is-official=true"  //只显示官方镜像

 显示是否为自动创建的镜像

 docker search ubuntu --filter "is-automated=true"  //只自动创建的仓库

5:查看镜像分层

    输入命令:docker image inspect ubuntu:latest

    输出:

    [
    {
        "Id": "sha256:3556258649b2ef23a41812be17377d32f568ed9f45150a26466d2ea26d926c32",
        "RepoTags": [
            "ubuntu:latest"
        ],
        "RepoDigests": [
            "ubuntu@sha256:c303f19cfe9ee92badbbbd7567bc1ca47789f79303ddcef56f77687d4744cd7a"
        ],
        "Parent": "",
        "Comment": "",
        "Created": "2019-07-23T15:21:13.01464074Z",
        "Container": "3b0e1c94bfe8f2670577cad66142287be14f02c7e49e9d1710073f6b8733bb48",
        "ContainerConfig": {
            "Hostname": "3b0e1c94bfe8",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": [
                "/bin/sh",
                "-c",
                "#(nop) ",
                "CMD [\"/bin/bash\"]"
            ],
            "ArgsEscaped": true,
            "Image": "sha256:6dd4850db8211ac5177f2729ad131f65d6472e95248c92b7fb95acfc609794e7",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": {}
        },
        "DockerVersion": "18.06.1-ce",
        "Author": "",
        "Config": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": [
                "/bin/bash"
            ],
            "ArgsEscaped": true,
            "Image": "sha256:6dd4850db8211ac5177f2729ad131f65d6472e95248c92b7fb95acfc609794e7",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": null
        },
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 64185514,
        "VirtualSize": 64185514,
        "GraphDriver": {
            "Data": {
                "LowerDir": "/mnt/sda1/var/lib/docker/overlay2/a6003e3ac734728a7ac69eb19453892ad619d1d23f246730c1c59e542f1277c6/diff:/mnt/sda1/var/lib/docker/overlay2/25fc962c359839b2565d1208e2558fa0afd676529ee4b18c87e9346466159feb/diff:/mnt/sda1/var/lib/docker/overlay2/5cc4ecda8dabb8415a0e316a09326a04414e5aefe7a5ee885f6af52838ddce91/diff",
                "MergedDir": "/mnt/sda1/var/lib/docker/overlay2/70dbca5fd3a27da47ff110d91b1b146a905b8e741871db773bfb6a5dc65299e3/merged",
                "UpperDir": "/mnt/sda1/var/lib/docker/overlay2/70dbca5fd3a27da47ff110d91b1b146a905b8e741871db773bfb6a5dc65299e3/diff",
                "WorkDir": "/mnt/sda1/var/lib/docker/overlay2/70dbca5fd3a27da47ff110d91b1b146a905b8e741871db773bfb6a5dc65299e3/work"
            },
            "Name": "overlay2"
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:543791078bdb84740cb5457abbea10d96dac3dea8c07d6dc173f734c20c144fe",
                "sha256:c56e09e1bd18e5e41afb1fd16f5a211f533277bdae6d5d8ae96a248214d66baf",
                "sha256:a31dbd3063d77def5b2562dc8e14ed3f578f1f90a89670ae620fd62ae7cd6ee7",
                "sha256:b079b3fa8d1b4b30a71a6e81763ed3da1327abaf0680ed3ed9f00ad1d5de5e7c"
            ]
        },
        "Metadata": {
            "LastTagTime": "0001-01-01T00:00:00Z"
        }
    }
]

在json节点RootFS可以看出ubuntu镜像有四层

 

 6:删除镜像

 

                

Guess you like

Origin www.cnblogs.com/wzt2019l/p/11285429.html