DockerでCentOS 5

古いPHP環境が欲しくなったので。

CentOS 5 のDockerイメージ探す

>docker search centos5
NAME                                                DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
astj/centos5-vault                                  A drop-in replacement of centos:5.11 with mo…   8                                       [OK]
fatherlinux/centos5-base                            Centos5, same method as RHEL5 image.            8
    :

良さげなイメージをダウンロード

>docker pull astj/centos5-vault
    :
>docker images
REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
astj/centos5-vault        latest              e79faab040e1        3 years ago         284MB

コンテナ新規作成実行・ログイン

>docker run -it --name centos5 astj/centos5-vault bash
# cat /etc/redhat-release
CentOS release 5.11 (Final)
# exit

コンテナ再実行・ログイン

>docker start centos5
>docker ps
    :
>docker exec -it centos5 bash
# exit

コンテナ停止

>docker stop centos5

PHPインストール

# yum install php
    :
Running Transaction
  Installing     : file                              1/15
  Installing     : libidn                            2/15
  Installing     : curl                              3/15
  Installing     : php-common                        4/15
  Installing     : gmp                               5/15
  Installing     : apr                               6/15
  Installing     : perl                              7/15
  Installing     : postgresql-libs                   8/15
  Installing     : apr-util                          9/15
  Installing     : mailcap                          10/15
  Installing     : httpd                            11/15
  Installing     : aspell                           12/15
  Installing     : php-cli                          13/15
  Installing     : php                              14/15
  Installing     : aspell-en                        15/15

Installed:
  php.x86_64 0:5.1.6-45.el5_11

Dependency Installed:
  apr.x86_64 0:1.2.7-11.el5_6.5
  apr-util.x86_64 0:1.2.7-11.el5_5.2
  aspell.x86_64 12:0.60.3-13
  aspell-en.x86_64 50:6.0-3
  curl.x86_64 0:7.15.5-17.el5_9
  file.x86_64 0:4.17-28
  gmp.x86_64 0:4.1.4-10.el5
  httpd.x86_64 0:2.2.3-92.el5.centos
  libidn.x86_64 0:0.6.5-1.1
  mailcap.noarch 0:2.1.23-1.fc6
  perl.x86_64 4:5.8.8-43.el5_11
  php-cli.x86_64 0:5.1.6-45.el5_11
  php-common.x86_64 0:5.1.6-45.el5_11
  postgresql-libs.x86_64 0:8.1.23-10.el5_10

Complete!
# php -v
PHP 5.1.6 (cli) (built: Nov  6 2014 12:25:07)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies