おれさまラボ

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

Dockerを試す - search

docker imageを検索する

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

docker searchコマンド

とりあえず、centosを探してみる。

[bargee@barge ~]$ docker search centos
NAME                                   DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
centos                                 The official build of CentOS.                   2777      [OK]
ansible/centos7-ansible                Ansible on Centos7                              90                   [OK]
jdeathe/centos-ssh                     CentOS-6 6.8 x86_64 / CentOS-7 7.2.1511 x8...   43                   [OK]
jdeathe/centos-ssh-apache-php          CentOS-6 6.8 x86_64 - Apache / PHP / PHP M...   22                   [OK]
nimmis/java-centos                     This is docker images of CentOS 7 with dif...   17                   [OK]
consol/centos-xfce-vnc                 Centos container with "headless" VNC sessi...   14                   [OK]
gluster/gluster-centos                 Official GlusterFS Image [ CentOS7 +  Glus...   13                   [OK]
million12/centos-supervisor            Base CentOS-7 with supervisord launcher, h...   12                   [OK]
torusware/speedus-centos               Always updated official CentOS docker imag...   8                    [OK]
nickistre/centos-lamp                  LAMP on centos setup                            8                    [OK]
kinogmt/centos-ssh                     CentOS with SSH                                 6                    [OK]
egyptianbman/docker-centos-nginx-php   A simple and highly configurable docker co...   5                    [OK]
nathonfowlie/centos-jre                Latest CentOS image with the JRE pre-insta...   4                    [OK]
centos/mariadb55-centos7                                                               3                    [OK]
centos/tools                           Docker image that has systems administrati...   3                    [OK]
consol/sakuli-centos-xfce              Sakuli JavaScript based end-2-end testing ...   2                    [OK]
blacklabelops/centos                   CentOS Base Image! Built and Updates Daily!     1                    [OK]
timhughes/centos                       Centos with systemd installed and running       1                    [OK]
harisekhon/centos-java                 Java on CentOS (OpenJDK, tags jre/jdk7-8)       1                    [OK]
harisekhon/centos-scala                Scala + CentOS (OpenJDK tags 2.10-jre7 - 2...   1                    [OK]
darksheer/centos                       Base Centos Image -- Updated hourly             1                    [OK]
ustclug/centos                          USTC centos                                    0                    [OK]
smartentry/centos                      centos with smartentry                          0                    [OK]
januswel/centos                        yum update-ed CentOS image                      0                    [OK]
repositoryjp/centos                    Docker Image for CentOS.                        0                    [OK]

いっぱい出てくる!説明が書かれているので、このなかから自分の好きなイメージを選べばよいわけですね。

例えば、「nginx」とか、、、

[bargee@barge ~]$ docker search nginx
NAME                      DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
nginx                     Official build of Nginx.                        4474      [OK]
jwilder/nginx-proxy       Automated Nginx reverse proxy for docker c...   843                  [OK]
richarvey/nginx-php-fpm   Container running Nginx + PHP-FPM capable ...   296                  [OK]
million12/nginx-php       Nginx + PHP-FPM 5.5, 5.6, 7.0 (NG), CentOS...   76                   [OK]
webdevops/php-nginx       Nginx with PHP-FPM                              58                   [OK]
maxexcloo/nginx-php       Framework container with nginx and PHP-FPM...   58                   [OK]
h3nrik/nginx-ldap         NGINX web server with LDAP/AD, SSL and pro...   31                   [OK]
bitnami/nginx             Bitnami nginx Docker Image                      19                   [OK]
million12/nginx           Nginx: extensible, nicely tuned for better...   8                    [OK]
gists/nginx               Nginx on Alpine                                 8                    [OK]
evild/alpine-nginx        Minimalistic Docker image with Nginx            8                    [OK]
maxexcloo/nginx           Framework container with nginx installed.       7                    [OK]
webdevops/nginx           Nginx container                                 5                    [OK]
1science/nginx            Nginx Docker images based on Alpine Linux       4                    [OK]
ixbox/nginx               Nginx on Alpine Linux.                          3                    [OK]
drupaldocker/nginx        NGINX for Drupal                                3                    [OK]
yfix/nginx                Yfix own build of the nginx-extras package      2                    [OK]
servivum/nginx            Nginx Docker Image with Useful Tools            2                    [OK]
frekele/nginx             docker run --rm --name nginx -p 80:80 -p 4...   2                    [OK]
dock0/nginx               Arch container running nginx                    2                    [OK]
xataz/nginx               Light nginx image                               2                    [OK]
tozd/nginx                Dockerized nginx.                               1                    [OK]
blacklabelops/nginx       Dockerized Nginx Reverse Proxy Server.          1                    [OK]
unblibraries/nginx        Baseline non-PHP nginx container                0                    [OK]
c4tech/nginx              Several nginx images for web applications.      0                    [OK]

例えば、「squid」とか、、、

[bargee@barge ~]$ docker search squid
NAME                       DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
sameersbn/squid                                                            77                   [OK]
orangeacme/squid           Squid running as a caching proxy with a 10...   5                    [OK]
minimum2scp/squid          squid3 cache service container running on ...   4                    [OK]
cloudposse/squid           Squid with `basic-auth` support.                1                    [OK]
reddec/squid               Docker (at least 1.3) image for Squid3 wit...   1                    [OK]
colstrom/squid             A full-featured Web proxy cache server.         1                    [OK]
scbunn/squid               Squid docker container based on alpine          1                    [OK]
vimagick/squid             A caching proxy for the Web supporting HTT...   1                    [OK]
hiracchi/squid             squid server                                    0                    [OK]
noodle05/squid             Alpine 3.4 based squid docker                   0                    [OK]
nouchka/squid              Squid3 container                                0                    [OK]
jameseckersall/squid       Squid                                           0                    [OK]
rkrahl/squid               A docker image for the Squid proxy server       0                    [OK]
zjqzero/squid              squid                                           0                    [OK]
gnesis/squid-docker        Squid in docker. Use to provide proxy server    0                    [OK]
konstruktoid/squid         Squid, a caching proxy, Docker image            0                    [OK]
whatwedo/squid             squid proxy                                     0                    [OK]
gaoyifan/squid             squid                                           0                    [OK]
ggtwlb0314/squid           squid proxy                                     0                    [OK]
babim/squid                Squid on debian                                 0                    [OK]
nerdammer/squid            Squid proxy to bypass authentication            0                    [OK]
lochnair/squid             Docker image for Squid based on Alpine Lin...   0                    [OK]
manubocquet/unraid-squid   Unraid squid                                    0                    [OK]
pantinor/squid             Alpine  Based Squid                             0                    [OK]
tsing/squid                squid                                           0                    [OK]

例えば、「postfix」とか、、、

[bargee@barge ~]$ docker search postfix
NAME                               DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
catatnight/postfix                 postfix with smtp authentication (sasldb) ...   72                   [OK]
marvambass/versatile-postfix       ready to use postfix (with smtp auth), whi...   18                   [OK]
linuxkonsult/postfix               Postfix configured with spamassassin and f...   7                    [OK]
tozd/postfix                       postfix Docker image.                           6                    [OK]
eeacms/postfix                     Postfix SMTP only Docker image with SMTP r...   4                    [OK]
cloyne/postfix                     postfix + Sympa integration Docker image.       2                    [OK]
panubo/postfix                     Simple Postfix SMTP Relay.                      1                    [OK]
indiehosters/postfix               postfix container for email service             1                    [OK]
jpco/postfix                       Made because I needed a well configurable ...   1                    [OK]
freeposte/postfix                  Freeposte.io SMTP server                        1                    [OK]
pataquets/postfix                                                                  1                    [OK]
referup/postfix                    postfix                                         0                    [OK]
cloudposse/postfix                 An SMTP services backed by `postfix` with ...   0                    [OK]
jbonachera/postfix                 postfix                                         0                    [OK]
vukor/postfix                      Build for postfix. Project available on ht...   0                    [OK]
lojzik/postfix                     postfix                                         0                    [OK]
zooniverse/postfix                 Postfix SMTP server                             0                    [OK]
nightexcessive/postfix-forwarder   postfix-forwarder is a Docker container th...   0                    [OK]
fonk/postfix                       docker container for postfix                    0                    [OK]
webdevops/postfix                  Postfix service container                       0                    [OK]
veny/postfix                       This image runs Postfix mail server on Cen...   0                    [OK]
sesceu/postfix                     postfix                                         0                    [OK]
1and1internet/ubuntu-16-postfix    Ubuntu 16 with Postfix                          0                    [OK]
spacecowboy/postfix                Postfix is an SMTP server, delivering outg...   0                    [OK]
wainox/postfix                     catatnight/postfix fork with viewable logs      0                    [OK]

いっぱいある!これで検証環境1からbuildしなくていい!勉強にはなるけど時間かかるんですよね。

もう少し詳細な情報を検索してみる

利用できるオプションは以下の通り。Starが多いほど人気のイメージになります。

[bargee@barge ~]$ docker search --help

Usage:  docker search [OPTIONS] TERM

Search the Docker Hub for images

  --automated        Only show automated builds
  --help             Print usage
  --no-trunc         Don't truncate output
  -s, --stars        Only displays with at least x stars

見つけたイメージをpullする

ほしいイメージが見つかったら、イメージ名:タグでpullすれば入手できます。

[bargee@barge ~]$ docker search squid | head -5
NAME                       DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
sameersbn/squid                                                            77                   [OK]
orangeacme/squid           Squid running as a caching proxy with a 10...   5                    [OK]
minimum2scp/squid          squid3 cache service container running on ...   4                    [OK]
cloudposse/squid           Squid with `basic-auth` support.                1                    [OK]
[bargee@barge ~]$
[bargee@barge ~]$
[bargee@barge ~]$ docker pull orangeacme/squid
Using default tag: latest
latest: Pulling from orangeacme/squid
a3ed95caeb02: Pull complete
6e71c809542e: Pull complete
d6b0ce4c9ac7: Pull complete
7725cac3b096: Pull complete
7d89a50b2c52: Pull complete
31bf72460a23: Pull complete
468e5994142c: Pull complete
1b59a249af46: Pull complete
f68b3adb9f99: Pull complete
26f960832cfc: Pull complete
699a8cf798ea: Pull complete
Digest: sha256:ae1cbb526e428c99156e2347e7263d3857e2b42ccdd14222c33e83cf98237720
Status: Downloaded newer image for orangeacme/squid:latest
[bargee@barge ~]$
[bargee@barge ~]$
[bargee@barge ~]$
[bargee@barge ~]$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
orangeacme/squid    latest              f835471f5b31        2 years ago         297.9 MB
[bargee@barge ~]$ docker inspect orangeacme/squid
[
    {
        "Id": "sha256:f835471f5b31ff64a6c3454f99234894f2a548f311753d9bf82811a476446005",
        "RepoTags": [
            "orangeacme/squid:latest"
        ],
        "RepoDigests": [],
        "Parent": "",
        "Comment": "",
        "Created": "2014-06-15T08:03:20.354565218Z",
        "Container": "84b83df8bcbc9b0a296c7c780e6a3e0bb0f11b5b0f2d7007e162e3aaaab83028",
        "ContainerConfig": {
            "Hostname": "6578e5106a94",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "3128/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "HOME=/",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": [
                "/bin/sh",
                "-c",
                "#(nop) CMD [/bin/sh -c /usr/sbin/squid3 -N -d 0]"
            ],
            "Image": "69eaec9ccdfbe2fe1d2b710efa452985f7acdceffc1afb4ff8fd238957fe67cd",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": [],
            "Labels": null
        },
        "DockerVersion": "0.11.1",
        "Author": "acme@astray.com",
        "Config": {
            "Hostname": "6578e5106a94",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "3128/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "HOME=/",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": [
                "/bin/sh",
                "-c",
                "/usr/sbin/squid3 -N -d 0"
            ],
            "Image": "69eaec9ccdfbe2fe1d2b710efa452985f7acdceffc1afb4ff8fd238957fe67cd",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": [],
            "Labels": null
        },
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 297858895,
        "VirtualSize": 297858895,
        "GraphDriver": {
            "Name": "overlay",
            "Data": {
                "RootDir": "/mnt/data/var/lib/docker/overlay/32449e2a7cb163990e3437b7b1e4e7cead2fa35785f46a058c9466d428ac0bd5/root"
            }
        }
    }
]

まとめ

こういうときにinspect使えばいいのかな。