前提条件
使用する RHEL7 のサブスクライブが完了していること。
#1.docker パッケージのインストール
$ subscription-manager repos --enable=rhel-7-server-extras-rpms
Repository 'rhel-7-server-extras-rpms' is enabled for this system.
$ yum install docker -y
#2.サービスの起動、有効化
$ systemctl start docker.service
$ systemctl enable docker.service
#3.Red Hat 社の Docker リポジトリからコンテナーイメージを取得
Docker リポジトリである Red Hat Container Catalog(RHCC)は以下。
https://access.redhat.com/containers/
取得する手順は以下の通り。
$ docker search registry.access.redhat.com/rhel
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
redhat.com registry.access.redhat.com/dotnet-beta/dotnet-20-rhel7 .NET Core 2.0 for RHEL 0
redhat.com registry.access.redhat.com/dotnet-beta/dotnet-20-runtime-rhel7 .NET Core 2.0 runtime for RHEL 0
redhat.com registry.access.redhat.com/dotnet/dotnet-20-jenkins-slave-rhel7 .NET Core 2.0 Jenkins Slave for RHEL 0
redhat.com registry.access.redhat.com/dotnet/dotnet-20-rhel7 .NET Core 2.0 for RHEL 0
redhat.com registry.access.redhat.com/dotnet/dotnet-20-runtime-rhel7 .NET Core 2.0 runtime for RHEL 0
redhat.com registry.access.redhat.com/dotnet/dotnet-21-jenkins-slave-rhel7 .NET Core 2.1 Jenkins Slave for RHEL 0
redhat.com registry.access.redhat.com/dotnet/dotnet-21-rhel7 .NET Core 2.1 for RHEL 0
redhat.com registry.access.redhat.com/dotnet/dotnet-21-runtime-rhel7 .NET Core 2.1 runtime for RHEL 0
redhat.com registry.access.redhat.com/dotnet/dotnetcore-10-rhel7 .NET Core 1.0 for RHEL 0
redhat.com registry.access.redhat.com/dotnet/dotnetcore-11-rhel7 .NET Core 1.1 for RHEL 0
redhat.com registry.access.redhat.com/rhel This platform image provides a minimal run... 0
redhat.com registry.access.redhat.com/rhel-6.10-beta This platform image provides a minimal run... 0
redhat.com registry.access.redhat.com/rhel-7.5-beta Provides Red Hat Enterprise Linux 7.5 Beta... 0
redhat.com registry.access.redhat.com/rhel-7.5-ppc64le Provides the latest release of Red Hat Ent... 0
redhat.com registry.access.redhat.com/rhel-7.5-ppc64le-beta Provides Red Hat Enterprise Linux 7.5 Beta... 0
redhat.com registry.access.redhat.com/rhel-7.5-s390x Provides the latest release of Red Hat Ent... 0
redhat.com registry.access.redhat.com/rhel-7.5-s390x-beta Provides Red Hat Enterprise Linux 7.5 Beta... 0
redhat.com registry.access.redhat.com/rhel-atomic Red Hat Enterprise Linux Atomic Image is a... 0
redhat.com registry.access.redhat.com/rhel6 This platform image provides a minimal run... 0
redhat.com registry.access.redhat.com/rhel6-init This container configures upstart to run c... 0
redhat.com registry.access.redhat.com/rhel6.10 This platform image provides a minimal run... 0
redhat.com registry.access.redhat.com/rhel6.5 This platform image provides a minimal run... 0
redhat.com registry.access.redhat.com/rhel6.6 This platform image provides a minimal run... 0
redhat.com registry.access.redhat.com/rhel6.7 This platform image provides a minimal run... 0
redhat.com registry.access.redhat.com/rhel6.8 This platform image provides a minimal run... 0
redhat.com registry.access.redhat.com/rhel6.9 This platform image provides a minimal run... 0
redhat.com registry.access.redhat.com/rhel6/rhel This platform image provides a minimal run... 0
redhat.com registry.access.redhat.com/rhel7 This platform image provides a minimal run... 0
redhat.com registry.access.redhat.com/rhel7-atomic Red Hat Enterprise Linux Atomic Image is a... 0
redhat.com registry.access.redhat.com/rhel7-init This image configures systemd for an OCI c... 0
redhat.com registry.access.redhat.com/rhel7-ppc64le Provides the latest release of Red Hat Ent... 0
redhat.com registry.access.redhat.com/rhel7-s390x Provides Red Hat Enterprise Linux 7 in a f... 0
redhat.com registry.access.redhat.com/rhel7-s390x-beta Provides Red Hat Enterprise Linux 7 in a f... 0
redhat.com registry.access.redhat.com/rhel7.0 This platform image provides a minimal run... 0
redhat.com registry.access.redhat.com/rhel7.1 This platform image provides a minimal run... 0
redhat.com registry.access.redhat.com/rhel7.2 This platform image provides a minimal run... 0
redhat.com registry.access.redhat.com/rhel7.3 This platform image provides a minimal run... 0
redhat.com registry.access.redhat.com/rhel7.4 This platform image provides a minimal run... 0
redhat.com registry.access.redhat.com/rhel7.5 This platform image provides a minimal run... 0
redhat.com registry.access.redhat.com/rhel7/rhel This platform image provides a minimal run... 0
redhat.com registry.access.redhat.com/rhel7/rhel-atomic Red Hat Enterprise Linux Atomic Image is a... 0
redhat.com registry.access.redhat.com/rhel7/rhel-tools Provides the core systems administrator an... 0
redhat.com registry.access.redhat.com/rhel7/rsyslog A containerized version of the rsyslog uti... 0
redhat.com registry.access.redhat.com/rhev4/rhevm-guest-agent The rhevm-guest-agent is providing informa... 0
redhat.com rhv4.1-beta/ovirt-guest-agent The ovirt-guest-agent is providing informa... 0
$
$ docker pull registry.access.redhat.com/rhel7 ★RHEL7 の最新イメージ
Using default tag: latest
Trying to pull repository registry.access.redhat.com/rhel7 ...
latest: Pulling from registry.access.redhat.com/rhel7
d02c3bd49e78: Pull complete
475b0168c252: Pull complete
Digest: sha256:befd9a4b4a49739045d672516a3cb4ddf17176112a8b941a078bee46e3575989
Status: Downloaded newer image for registry.access.redhat.com/rhel7:latest
$
$ docker pull registry.access.redhat.com/rhel6 ★RHEL6 の最新イメージ
Using default tag: latest
Trying to pull repository registry.access.redhat.com/rhel6 ...
latest: Pulling from registry.access.redhat.com/rhel6
bf6e27f8d161: Pull complete
8e4d19e4d58d: Pull complete
Digest: sha256:38d53dbc4e380556f34d69dfe37f979905e659f96b29bf6fb44475a8b97d6aaf
Status: Downloaded newer image for registry.access.redhat.com/rhel6:latest
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
registry.access.redhat.com/rhel6 latest b8952d1c7180 4 days ago 200 MB
registry.access.redhat.com/rhel7 latest e64297b706b7 7 days ago 201 MB
$
#4.コンテナの起動
$ docker run -d -it --name=rhel7 registry.access.redhat.com/rhel7:latest /bin/bash
a2c0f0286741065ad5962fc2e12e5e2073aaa8f1e1360313c041ff6fc3fbe525
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a2c0f0286741 registry.access.redhat.com/rhel7:latest "/bin/bash" 3 seconds ago Up 2 seconds rhel7
$
$ docker exec -it rhel7 /bin/bash
root@a2c0f0286741 /# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.5 (Maipo)
root@a2c0f0286741 /#
コンテナの詳細については、上記であればコンテナ内の /root/buildinfo 配下や以下に情報がある。
https://access.redhat.com/containers/?tab=overview#/registry.access.redhat.com/rhel7
コンテナで systemctl を実行したい場合、コンテナの起動は以下のコマンドで実施する必要がある。
Is running systemd inside of a docker container supported?
https://access.redhat.com/solutions/1118173
# docker run -d --name test --stop-signal SIGRTMIN+3 -ti registry.access.redhat.com/rhel7 init
参考情報
今日からできるDocker on RHEL7
http://jp-redhat.com/migration/docker/article.html
Red Hat Container Catalog (RHCC) を使ってみよう!
http://jp-redhat.com/openeye_online/column/oss-note/5894/
Product Documentation for Red Hat Enterprise Linux Atomic Host 7 コンテナーの使用ガイド
https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux_atomic_host/7/html/getting_started_with_containers/
How to use docker command under proxy
https://access.redhat.com/solutions/2352241
※プロキシ環境の場合は上記の設定をしないとコンテナーイメージが取得できない