ドッカー鏡(画像)

クリエイティブコモンズライセンス 著作権:帰属、紙ベースを作成するために他人を許可し、(同じライセンスで元のライセンス契約に基づいて用紙配布する必要がありますクリエイティブコモンズ

著作権、許可なしに、禁止されて再版


セクション


ドッカーでは、ミラー上のすべてのものは、基本的にファイルシステムおよびコンフィギュレーションパラメータ鏡を組み合わせたものです。

一般に、例えば、アプリケーションの鏡像に対応する:ミラーは、ミラーが複数のインスタンスを持つことができ、nginxのnginxのアプリケーションインスタンス実行画像(画像アプリケーションを含む)のコンテナと呼ばれています。

ドッカープログラムができ、一連のコマンドをサポートしているdocker helpコマンドを参照してください。

例として、次のコマンドを実行します。

docker run hello-world 
  • runドッカーは、コマンドを実行しているの鏡像のインスタンス伝えhellow-worldミラーは、ドッカーハブからダウンロード存在しない場合は、アプリケーションコンテナを。
  • hello-worldミラーの仕様

Busyboxのミラーを実行しているの例を見てみましょう:

$ sudo docker run -it --rm busybox
  • ドッキングウィンドウのコマンドを使用して、root権限で実行されますsudo
  • busyboxミラーの名前です。
  • -it 対話モードで実行表します
  • --rm コンテナが停止された後、自動的に削除

このコマンドは、システムがbusyboxのの入った、busyboxのミラーをダウンロードして実行しますshターミナルを。

ミラーは、表示ドッカーをマウント

ドッカーミラーは、システムにインストールを確認するには、次のコマンドを実行します。

シンプルな使い方

docker images

オプション

  • -q - 出力のみ画像ID

返却値

ミラーリストにインストールされている印刷システム

[root@qikegu ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
busybox             latest              64f5d945efcc        10 days ago         1.2MB
php                 7-fpm               d330e525cad6        6 weeks ago         367MB
nginx               latest              2bcb04bdb83f        7 weeks ago         109MB
hello-world         latest              fce289e99eb9        4 months ago        1.84kB
jenkins             latest              cd14cecfdb3a        10 months ago       696MB

上述したように、ミラーは、以下の特性を有しています

  • TAG -ミラーラベル、タグ実装ミラー指定することができる同様のバージョン、各ミラードッカーハブラベルの詳細な手順
  • 画像ID - ミラーID、独自のロゴ画像
  • 作成 - ミラーを作成
  • 仮想サイズ - 画像サイズ

次の例では、使用-qパラメータのみ出力画像IDを:

[root@qikegu ~]# docker images -q
64f5d945efcc
502d06d3bfdf
d330e525cad6
2bcb04bdb83f
fce289e99eb9
cd14cecfdb3a

ファイル名を指定して実行ドッカーミラー

あなたは使用することができますdocker runインストールされていない場合は、ミラーを実行するコマンドを開始しますドッカーハブダウンロードミラーを。

シンプルな使い方

docker run image 

オプション

  • イメージ -イメージの名前/ IDを指定します。

返却値

指定されたイメージをダウンロードして実行します。

[root@qikegu ~]# docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

ドッカーミラーを削除します

docker rmiコマンドは、システムにインストールされてドッカミラーを削除します。

シンプルな使い方

 docker rmi image

オプション

  • 画像 -ミラーを除去する(名前またはID)

返却値

指定された画像を削除します。

ノードのミラーを削除します。

[root@qikegu ~]# docker rmi 502d06d3bfdf
Untagged: node:latest
Untagged: node@sha256:3d4411d1933dc93e78b9e0de556a22178269952b98cbbea7ca935d890527ae27
Deleted: sha256:502d06d3bfdf8b91c5b0d6db2f36a6da816a374807cdab01edcd1602ec0e8572
Deleted: sha256:bdd7d668ca8f7724e211e1773eb2ff8c4875a525d31eaf74abe3b9d3c2f70d2a
Deleted: sha256:57d08b934ce43d2861a7a44f4136b244b1bca7ecbe5904ab4d04ddae703aa4af
Deleted: sha256:8d8dabce32d508dfcd126ab43cde7b690764c4bd06800e7cac816d367473ad3e
Deleted: sha256:addff6454b75bcccc23ba0cdbf9ff5d83f6df71523cd3428261d1785c3e3c592
Deleted: sha256:dae4f674403b331cb8c19b2c238ffa7d5a7249a1b4fafc4725054201dce3341a
Deleted: sha256:a9a9c8853295275070975beba78ec0f573172e6e41b30232a00d8af0d49b8ef3
Deleted: sha256:ddf0293e8e23246803d265b158ffbb9453d925fe392b43515984815853e9121b
Deleted: sha256:f94641f1fe1f5c42c325652bf55f0513c881c86b620b912b15460e0bca07cc12

ドッキングウィンドウ点検

このコマンドは、ミラーの詳細を表示することができます。

シンプルな使い方

docker inspect image 

オプション

  • 画像 -ミラーの名前またはID。

返却値

出力ミラーの詳細。

[root@qikegu ~]# docker inspect busybox
[
    {
        "Id": "sha256:64f5d945efcc0f39ab11b3cd4ba403cc9fefe1fa3613123ca016cf3708e8cafb",
        "RepoTags": [
            "busybox:latest"
        ],
        "RepoDigests": [
            "busybox@sha256:4b6ad3a68d34da29bf7c8ccb5d355ba8b4babcad1f99798204e7abb43e54ee3d"
        ],
        "Parent": "",
        "Comment": "",
        "Created": "2019-05-09T21:19:58.308508481Z",
        "Container": "8af67ba15d5afe424a7de8f00dba68d886256ff687e8c01b539d79fcc4a5eb31",
        "ContainerConfig": {
            "Hostname": "8af67ba15d5a",
            "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 [\"sh\"]"
            ],
            "ArgsEscaped": true,
            "Image": "sha256:6d548ae6d7d617ec5ce4cd94c61d0df45d5eeeab5d717398736d14437bb0faa5",
            "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": [
                "sh"
            ],
            "ArgsEscaped": true,
            "Image": "sha256:6d548ae6d7d617ec5ce4cd94c61d0df45d5eeeab5d717398736d14437bb0faa5",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": null
        },
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 1199418,
        "VirtualSize": 1199418,
        "GraphDriver": {
            "Data": {
                "MergedDir": "/var/lib/docker/overlay2/ca7aa9c486b89ae8b6dce263d7d94702e2597f9e8a873461182                                    8d7c4a480170c/merged",
                "UpperDir": "/var/lib/docker/overlay2/ca7aa9c486b89ae8b6dce263d7d94702e2597f9e8a8734611828                                    d7c4a480170c/diff",
                "WorkDir": "/var/lib/docker/overlay2/ca7aa9c486b89ae8b6dce263d7d94702e2597f9e8a8734611828d                                    7c4a480170c/work"
            },
            "Name": "overlay2"
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:d1156b98822dccbb924b4e5fe16465a7ecac8bfc81d726177bed403a8e70c972"
            ]
        },
        "Metadata": {
            "LastTagTime": "0001-01-01T00:00:00Z"
        }
    }
]

コマンドの使用方法の詳細は、使用docker help commandたとえば、表示します:docker help rmi

おすすめ

転載: blog.csdn.net/weixin_43031412/article/details/94550835