おれさまラボ

実際に手を動かして理解を深めるブログ。

Dockerを試す - pull

イメージのダウンロード

教科書に沿って、演習していきます。

docker pull

docker runで「イメージ名:タグ」指定するだけでも勝手にイメージ引っ張ってきてくれるみたいですが、明示的にイメージをひっぱてくることも可能です。

[bargee@barge ~]$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              latest              f753707788c5        2 weeks ago         127.1 MB
[bargee@barge ~]$ docker pull centos:7
7: Pulling from library/centos
8d30e94188e7: Pull complete
Digest: sha256:2ae0d2c881c7123870114fb9cc7afabd1e31f9888dac8286884f6cf59373ed9b
Status: Downloaded newer image for centos:7
[bargee@barge ~]$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              latest              f753707788c5        2 weeks ago         127.1 MB
centos              7                   980e0e4c79ec        7 weeks ago         196.7 MB

centos7のイメージを引っ張ってこれました。

タグ名を省略してpull

タグを省略すると、最新バージョンを引っ張ってきます。

[bargee@barge ~]$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
[bargee@barge ~]$ docker pull centos
Using default tag: latest
latest: Pulling from library/centos
8d30e94188e7: Pull complete
Digest: sha256:2ae0d2c881c7123870114fb9cc7afabd1e31f9888dac8286884f6cf59373ed9b
Status: Downloaded newer image for centos:latest
[bargee@barge ~]$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
centos              latest              980e0e4c79ec        7 weeks ago         196.7 MB

イメージのすべてのバージョンをpullする

「-a」オプションをつけることで、そのイメージのすべてのバージョンを引っ張って来れます。 例えば、CentOSで試すとこんな感じ。

[bargee@barge ~]$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
[bargee@barge ~]$ docker pull -a centos
5.11: Pulling from library/centos
2068b24f564b: Pull complete
Digest: sha256:f5ac6bb54c5042387c79c83fca93eff7b721da54ab995fd64a20b23f6785465d
5: Pulling from library/centos
38892065247a: Pull complete
Digest: sha256:d4bf3d8f4efaf9c2f2be4735385da0f1c910f2b2fa89b6fe833890a125b676d5
6.6: Pulling from library/centos
90577c79babf: Pull complete
Digest: sha256:91010f787aaade33757898348054c8d6dc8ec7361a6d53c2b62cf67022476b6e
6.7: Pulling from library/centos
5237cae4d629: Pull complete
Digest: sha256:1f4e3e2e3450b60d02445ff85818699e65f4eec00671b0a41bf60a0271a68997
6.8: Pulling from library/centos
67f15db7c18f: Pull complete
Digest: sha256:699d6ab3b404f286b5f5e88415e05668b7af39413d2941aa2bdf1a843b77e9ed
6: Pulling from library/centos
f402e43879a8: Pull complete
Digest: sha256:f3cc24b376d42d9fd9fa914335dddee46ed7b5a2e2dd1ee6df045ce437199d79
7.0.1406: Pulling from library/centos
6728cc84db62: Pull complete
Digest: sha256:55a28fe16008c3d7884232613d651c82787f2819d7010f9ff7ca13f49a2343a6
7.1.1503: Pulling from library/centos
77fe1992330f: Pull complete
Digest: sha256:98c7685ff425415f7784b036de441714548fe9862f7a6a5615c176c6c8c8a1b8
7.2.1511: Pulling from library/centos
a2392627bec4: Pull complete
Digest: sha256:0d121fa7987c60c3f7ecb8d7347d8e86683018625e44f3864e69b388087a4d0b
7: Pulling from library/centos
8d30e94188e7: Pull complete
Digest: sha256:2ae0d2c881c7123870114fb9cc7afabd1e31f9888dac8286884f6cf59373ed9b
centos5.11: Pulling from library/centos
Digest: sha256:f5ac6bb54c5042387c79c83fca93eff7b721da54ab995fd64a20b23f6785465d
centos5: Pulling from library/centos
Digest: sha256:d4bf3d8f4efaf9c2f2be4735385da0f1c910f2b2fa89b6fe833890a125b676d5
centos6.6: Pulling from library/centos
Digest: sha256:91010f787aaade33757898348054c8d6dc8ec7361a6d53c2b62cf67022476b6e
centos6.7: Pulling from library/centos
Digest: sha256:1f4e3e2e3450b60d02445ff85818699e65f4eec00671b0a41bf60a0271a68997
centos6.8: Pulling from library/centos
Digest: sha256:699d6ab3b404f286b5f5e88415e05668b7af39413d2941aa2bdf1a843b77e9ed
centos6: Pulling from library/centos
Digest: sha256:f3cc24b376d42d9fd9fa914335dddee46ed7b5a2e2dd1ee6df045ce437199d79
centos7.0.1406: Pulling from library/centos
Digest: sha256:55a28fe16008c3d7884232613d651c82787f2819d7010f9ff7ca13f49a2343a6
centos7.1.1503: Pulling from library/centos
Digest: sha256:98c7685ff425415f7784b036de441714548fe9862f7a6a5615c176c6c8c8a1b8
centos7.2.1511: Pulling from library/centos
Digest: sha256:0d121fa7987c60c3f7ecb8d7347d8e86683018625e44f3864e69b388087a4d0b
centos7: Pulling from library/centos
Digest: sha256:2ae0d2c881c7123870114fb9cc7afabd1e31f9888dac8286884f6cf59373ed9b
latest: Pulling from library/centos
Digest: sha256:2ae0d2c881c7123870114fb9cc7afabd1e31f9888dac8286884f6cf59373ed9b
Status: Downloaded newer image for centos
[bargee@barge ~]$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
centos              6                   f07f6ca555a5        7 weeks ago         194.6 MB
centos              centos6             f07f6ca555a5        7 weeks ago         194.6 MB
centos              7                   980e0e4c79ec        7 weeks ago         196.7 MB
centos              centos7             980e0e4c79ec        7 weeks ago         196.7 MB
centos              latest              980e0e4c79ec        7 weeks ago         196.7 MB
centos              5.11                b424fba01172        8 weeks ago         284.1 MB
centos              centos5.11          b424fba01172        8 weeks ago         284.1 MB
centos              6.6                 d03626170061        8 weeks ago         202.6 MB
centos              centos6.6           d03626170061        8 weeks ago         202.6 MB
centos              6.7                 ab44245321a8        8 weeks ago         190.6 MB
centos              centos6.7           ab44245321a8        8 weeks ago         190.6 MB
centos              6.8                 0cd976dc0a98        8 weeks ago         194.5 MB
centos              centos6.8           0cd976dc0a98        8 weeks ago         194.5 MB
centos              7.0.1406            16e9fdecc1fe        8 weeks ago         210.2 MB
centos              centos7.0.1406      16e9fdecc1fe        8 weeks ago         210.2 MB
centos              7.1.1503            285396d0a019        8 weeks ago         212.1 MB
centos              centos7.1.1503      285396d0a019        8 weeks ago         212.1 MB
centos              7.2.1511            feac5e0dfdb2        8 weeks ago         194.6 MB
centos              centos7.2.1511      feac5e0dfdb2        8 weeks ago         194.6 MB
centos              5                   1ae98b2c895d        8 weeks ago         284.7 MB
centos              centos5             1ae98b2c895d        8 weeks ago         284.7 MB
[bargee@barge ~]$

使い所は、わからない。

URL指定でpullする

URLを指定して pullすることもできます。その際、プロトコル部分(https://)は不要であることに注意。