Docker 0.9.0 for CentOS6.5

##インストール

```shell:shell
# rpm -ivh  http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
# sed -i 's/^enabled=1/enabled=0/g' /etc/yum.repos.d/epel.repo
# yum install docker-io --enablerepo=epel
```
>
```shell:result
Dependencies Resolved
>
===================================================================================================================
 Package                      Arch             Version                                     Repository         Size
===================================================================================================================
Installing:
 docker-io                    x86_64           0.9.0-3.el6                                 epel              4.1 M
Installing for dependencies:
 bridge-utils                 x86_64           1.2-10.el6                                  base               30 k
 device-mapper                x86_64           1.02.79-8.el6                               base              164 k
 device-mapper-libs           x86_64           1.02.79-8.el6                               base              195 k
 libcgroup                    x86_64           0.40.rc1-5.el6_5.1                          updates           125 k
 libudev                      x86_64           147-2.51.el6                                base               74 k
 lxc                          x86_64           0.9.0-2.el6                                 epel               78 k
 lxc-libs                     x86_64           0.9.0-2.el6                                 epel              116 k
 xz                           x86_64           4.999.9-0.3.beta.20091007git.el6            base              137 k
>
Transaction Summary
===================================================================================================================
>
Install       9 Package(s)
```
>
###docker-ioパッケージの中身確認
>
```shell:shell
# (LANG=C; rpm -qs docker-io)
```
>>
```shell:result
normal        /etc/bash_completion.d
normal        /etc/bash_completion.d/docker.bash
normal        /etc/rc.d/init.d/docker
normal        /etc/sysconfig/docker
normal        /etc/udev/rules.d
normal        /etc/udev/rules.d/80-docker.rules
normal        /usr/bin/docker
normal        /usr/libexec/docker
normal        /usr/libexec/docker/dockerinit
normal        /usr/share/doc/docker-io-0.9.0
normal        /usr/share/doc/docker-io-0.9.0/AUTHORS
normal        /usr/share/doc/docker-io-0.9.0/CHANGELOG.md
normal        /usr/share/doc/docker-io-0.9.0/CONTRIBUTING.md
normal        /usr/share/doc/docker-io-0.9.0/FIXME
normal        /usr/share/doc/docker-io-0.9.0/LICENSE
normal        /usr/share/doc/docker-io-0.9.0/LICENSE-vim-syntax
normal        /usr/share/doc/docker-io-0.9.0/MAINTAINERS
normal        /usr/share/doc/docker-io-0.9.0/NOTICE
normal        /usr/share/doc/docker-io-0.9.0/README-vim-syntax.md
normal        /usr/share/doc/docker-io-0.9.0/README.md
normal        /usr/share/man/man1/docker.1.gz
normal        /usr/share/vim/vimfiles/doc
normal        /usr/share/vim/vimfiles/doc/dockerfile.txt
normal        /usr/share/vim/vimfiles/ftdetect
normal        /usr/share/vim/vimfiles/ftdetect/dockerfile.vim
normal        /usr/share/vim/vimfiles/syntax
normal        /usr/share/vim/vimfiles/syntax/dockerfile.vim
normal        /usr/share/zsh/site-functions/_docker
normal        /var/lib/docker
```
>
###起動確認
インストール時に自動起動設定がデフォルトでONになっている
>
```shell:shell
# chkconfig --list docker
```
>>
```shell:result
docker          0:off   1:off   2:on    3:on    4:on    5:on    6:off
```

##docker起動
```shell:shell
# /etc/init.d/docker start
```
>
```shell:result
Starting cgconfig service:                                 [  OK  ]
Starting docker:                                           [  OK  ]
```
>
###ディレクトリ構造確認
>
```shell:
# tree /var/lib/docker/
```
>>
```shell:result
/var/lib/docker/
|-- containers
|-- devicemapper
|   `-- devicemapper
|       |-- data
|       `-- metadata
|-- graph
|-- repositories-vfs
`-- volumes
```

##バージョン確認
```shell:shell
# docker version
```
>
```shell:result
Client version: 0.9.0
Go version (client): go1.2
Git commit (client): 2b3fdf2/0.9.0
Server version: 0.9.0
Git commit (server): 2b3fdf2/0.9.0
Go version (server): go1.2
Last stable version: 0.10.0, please update docker
```

##docker オフィシャルからOSイメージ取得
https://index.docker.io/
>
| pre-built image name |
|:--                   |
| centos               |
| fedora               |
| ubuntu               |
| debian               |
| busybox              |
>
###保有OSイメージの確認
```shell:shell
# docker images
```
>>
```shell:result
REPOSITORY          TAG                 IMAGE ID            CREATED              VIRTUAL SIZE
```
>
###docker オフィシャルからCentOSイメージ取得
```shell:shell
#docker pull centos
```
>>
```shell:result
Unable to find image 'centos' locally
Pulling repository centos
539c0211cd76: Downloading [=================>                                 ] 34.34 MB/98.56 MB 9s
```
>
###保有OSイメージの確認
```shell:shell
# docker images
```
>>
```shell:result
REPOSITORY          TAG                 IMAGE ID            CREATED              VIRTUAL SIZE
centos              6.4                 539c0211cd76        12 months ago        300.6 MBdd>
```

##仮想コンテナの確認
>
###仮想コンテナ作成前
```shell:result
# docker ps -a
```
>>
```shell:result
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS              PORTS               NAMES
```
>
###仮想コンテナを作成してみる
```shell:
# docker run -i -t centos /bin/bash
```
>>
```shell:result
bash-4.1# hostname
726e3b1bfbeb
bash-4.1# exit
exit
```
>
###仮想コンテナ作成後
```shell:result
# docker ps -a
```
>>
```shell:result
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS              PORTS               NAMES
726e3b1bfbeb        centos:6.4          /bin/bash           About a minute ago   Exit 0                                  suspicious_galileo
```

##仮想コンテナの破棄
```shell:shell
# docker rm `docker ps -a -q`
```
>
```shell:result
726e3b1bfbeb
```

##OSイメージの削除
>
###削除前確認
```shell:shell
# docker images
```
>>
```shell:result
REPOSITORY          TAG                 IMAGE ID            CREATED              VIRTUAL SIZE
centos              6.4                 539c0211cd76        12 months ago        300.6 MBdd>
```
>
###centosイメージの削除
>
```shell:shell
# docker rmi centos
```
>>
```sell:result
Untagged: centos:latest
Deleted: 539c0211cd76cdeaedbecf9f023ef774612e331137ce7ebe4ae1b61088e7edbe
```
>
###削除後確認
>>
```shell:shell
# docker images
```
>>
```shell:result
REPOSITORY          TAG                 IMAGE ID            CREATED              VIRTUAL SIZE
```