CentOS7 の docker を準備した話

概要

CentOS7 の Docker を準備した話です

CentOS7 に Docker をインストールする

yum でインストールしたあとサービスを起動する必要がある.

# yum install docker
# systemctl enable docker
# systemctl start docker

Docker のイメージを取得する

Docker Hub から CentOS のイメージを取得する

// Docker Hub を検索する
// ユーザが登録したリポジトリは <ユーザ名>/ をつける決まりになっている
# docker search centos
NAME                                            DESCRIPTION                                     STARS     OFFICIAL   TRUSTED
centos                                          The official build of CentOS.                   517       [OK]       
tianon/centos                                   CentOS 5 and 6, created using rinse instea...   28                   
<以下略>

// イメージを取得する
// 今回は OFFICIAL から centos のイメージを取得
# docker pull centos
Pulling repository centos
87e5b6b3ccc1: Download complete 
504a65221a38: Download complete 
68edf809afe7: Download complete 
511136ea3c5a: Download complete 
5b12ef8fd570: Download complete 

// イメージの一覧を表示する
// CentOS 5, 6, 7 と最新のイメージが配布されている
# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
centos              centos5             504a65221a38        13 days ago         467.1 MB
centos              centos6             68edf809afe7        13 days ago         212.7 MB
centos              centos7             87e5b6b3ccc1        13 days ago         224 MB
centos              latest              87e5b6b3ccc1        13 days ago         224 MB