以前、CentOSがなくなり移行先をどうするかというようなことがネットでも話題になっていましたが、それに加えてRHELのライセンスも緩和されたということも同じように話題になっていました。自分はCentOSもRHELも使用していませんが、今後のためにRedHat系のLinuxディストリビューションの状況も少しは見ておいたほうがいいかなと思いました。そこで、ライセンスが緩和されたRHELをWindows10のDocker環境に導入してみようかなと思います。Docker Desktopも有料化されるとか…この界隈も結構状況が変わってきましたね。
雑な説明になりますが、RHELは16台まで使用可能に緩和、Docker Desktopは個人利用は無償のままです。
【参考:「CentOS Linux」終了へ 開発者の動揺と救済の動き】 cloud.watch.impress.co.jp
【参考:開発者向けサブスクリプションサービス「Red Hat Developer」プログラムを改訂】 www.redhat.com
【参考:Docker Desktop有料化の影響】 qiita.com
DockerにRHELのコンテナイメージをインストールするのはそんな難しくはないだろうなと思っていたのですが、あんまり情報がなくてびっくりしました。そういう使い方をしないということなのでしょうか?(ライセンスの問題?)
ネットで検索すると、RHELにDockerをインストールしてコンテナ環境を構築するパターン、あるいはRedHat製のPodmanというDocker互換のアプリケーションでの導入するパターンといった情報はでてくるのですが、WindowsなどのDocker環境にRHELコンテナを導入する情報があまりありません。
そこで、RHELコンテナの導入に関する情報をまとめてみたいと思います。
RHELコンテナイメージについて
RHELのコンテナイメージであるUniversal Base Images (UBI)は以下のリンクに詳しく書かれています。
コンテナイメージは以下のようなものが使用できるようです。
- Red Hat Universal Base Image 7 Server (RPMs)
- Red Hat Universal Base Image Atomic Host (RPMs)
- Red Hat Developer Tools RPMs for Red Hat Universal Base Image 7 Server
- Red Hat Universal Base Image 7 Server - Extras (RPMs)
- Red Hat Universal Base Image 7 Server - Optional (RPMs)
- Red Hat Software Collections RPMs for Red Hat Universal Base Image 7 Server
いろいろ検索するうちに以下のリンクにたどり着きました。ここが一番参考になりました。
どうもDockerでの情報が少なくなっているのは以下のようなことがあったからのようです。
When Red Hat Enterprise Linux (RHEL) 8 was released almost a year ago, and it came with lots of new features related to containers. The biggest ones were the new container tools (Podman, Buildah, and skopeo) and the new Red Hat Universal Base Images. There was also confusion because RHEL 8 dropped support for the Docker toolset. Some developers thought that they could not work with Docker anymore, and had to either migrate to a Red Hat-ecosystem Linux system such as CentOS or stay away from Red Hat customers.
Red Hat Enterprise Linux(RHEL)8がリリースされた約1年前には、コンテナに関連する新機能がたくさん搭載されていました。最も大きなものは、新しいコンテナツール(Podman、Buildah、skopeo)と新しいRed Hat Universal Base Imagesでした。また、RHEL 8がDockerツールセットのサポートをやめたため、混乱が生じました。開発者の中には、Dockerではもう仕事ができないと考え、CentOSなどのRed HatエコシステムのLinuxシステムに移行するか、Red Hatの顧客に近づかないようにしなければならなかった。
DockerにRHELコンテナを導入する
では、dockerコマンドをつかって導入していきましょう。コンテナイメージはregistry.access.redhat.com/ubiリポジトリに格納されています。docker searchコマンドで取得できるコンテナイメージを検索してみます。
PS > docker search registry.access.redhat.com/ubi NAME DESCRIPTION STARS OFFICIAL AUTOMATED ubi7/ubi-minimal The Universal Base Image Init is designed to… 0 ubi7/ubi-init The Universal Base Image Init is designed to… 0 ubi8-minimal The Universal Base Image Minimal is a stripp… 0 ubi7 The Universal Base Image is designed and eng… 0 ubi7-minimal The Universal Base Image Minimal is a stripp… 0 ubi8/ubi-micro Provides the latest release of Micro Univers… 0 ubi7/ubi The Universal Base Image is designed and eng… 0 ubi8/ubi Provides the latest release of the Red Hat U… 0 ubi8/ubi-minimal Provides the latest release of the Minimal R… 0 ubi8/ubi-init Provides the latest release of the Red Hat U… 0 ubi8 The Universal Base Image is designed and eng… 0 ubi8-init The Universal Base Image Init is designed to… 0 ubi7-init The Universal Base Image Init is designed to… 0 ubi8-micro Provides the latest release of Micro Univers… 0 ubi8/openjdk-8-runtime OpenJDK 1.8 runtime-only image on Red Hat Un… 0 ubi8/openjdk-11-runtime OpenJDK 11 runtime-only image on Red Hat Uni… 0 ubi8/go-toolset Platform for building and running Go 1.11.5 … 0 ubi7/s2i-core Base image which allows using of source-to-i… 0 ubi7/php-72 Apache 2.4 with PHP 7.2 0 ubi7/go-toolset Platform for building and running Go Applica… 0 ubi7/nodejs-10 Platform for building and running Node.js 10… 0 ubi7/nodejs-12 Platform for building and running Node.js 12… 0 ubi7/python-36 Platform for building and running Python 3.6… 0 ubi7/ruby-26 Platform for building and running Ruby 2.5 a… 0 ubi7/ruby-27 Platform for building and running Ruby 2.7 a… 0 ubi7/python-38 Python 3.8 platform for building and running… 0 ubi7/nodejs-8 Platform for building and running Node.js 8 … 0 ubi7/ruby-25 Platform for building and running Ruby 2.5 a… 0 ubi7/python-27 Python 2.7 platform for building and running… 0 ubi7/php-73 Platform for building and running PHP 7.3 ap… 0 ubi8/nodejs-10 Platform for building and running Node.js 10… 0 ubi8/ruby-25 Platform for building and running Ruby 2.5 a… 0 ubi8/nodejs-14 Platform for building and running Node.js 14… 0 ubi8/s2i-core Base image which allows using of source-to-i… 0 ubi8/python-27 Platform for building and running Python 2.7… 0 ubi8/python-36 Platform for building and running Python 3.6… 0 ubi8/ruby-26 Platform for building and running Ruby 2.6 a… 0 ubi8/nodejs-12 Platform for building and running Node.js 12… 0 ubi8/python-38 Platform for building and running Python 3.8… 0 ubi7/s2i-base Base image with essential libraries and tool… 0 ubi8/dotnet-21-runtime Provides the latest release of Red Hat Enter… 0 ubi8/perl-526 Platform for building and running Perl 5.26 … 0 ubi8/dotnet-30-runtime .NET Core 3.0 runtime only on RHEL 8 0 ubi8/openjdk-11 Source To Image (S2I) image for Red Hat Open… 0 ubi8/dotnet-31 .NET Core 3.1 SDK and Runtime on RHEL 8 0 ubi7/nodejs-14 Platform for building and running Node.js 14… 0 ubi8/php-72 Platform for building and running PHP 7.2 ap… 0 ubi8/dotnet-21 .NET Core 2.1 SDK and Runtime on RHEL 8 0 ubi8/php-73 Platform for building and running PHP 7.3 ap… 0 ubi8/dotnet-30 .NET Core 3.0 SDK and Runtime on RHEL 8 0 ubi8/openjdk-8 Source To Image (S2I) image for Red Hat Open… 0 ubi8/dotnet-31-runtime .NET Core 3.1 runtime only on RHEL 8 0 ubi8/s2i-base Base image with essential libraries and tool… 0 ubi7/nginx-118 Platform for running nginx 1.18 or building … 0 ubi7/ruby-30 Ruby 3.0 0 ubi8/perl-530 Platform for building and running Perl 5.26 … 0 ubi8/php-74 Platform for building and running PHP 7.4 ap… 0 ubi8/dotnet-50-runtime .NET 5.0 runtime only on RHEL 8 0 ubi8/buildah Containerized version of Buildah 0 ubi8/nodejs-14-minimal Minimal image for running Node.js 14 applica… 0 ubi8/nginx-118 Platform for running nginx 1.18 or building … 0 ubi8/ruby-27 Platform for building and running Ruby 2.7 a… 0 ubi8/dotnet-50 .NET 5.0 SDK and Runtime on RHEL 8 0 ubi8/pause Podman pod infrastructure container 0 ubi8/skopeo Containerized version of Skopeo 0 ubi8/python-39 Platform for building and running Python 3.9… 0 ubi8/httpd-24 Platform for running Apache httpd 2.4 or bui… 0
かなり大量のイメージが提供されていました。
あとは、このリポジトリを指定して、上記のイメージをdocker pullやdocker runなどでコンテナを導入すればOKです。
今回はubi8/ubiを使用します。
docker pullを使用した場合
PS > docker pull registry.access.redhat.com/ubi8/ubi Using default tag: latest latest: Pulling from ubi8/ubi 296e14ee2414: Pull complete 356f18f3a935: Pull complete Digest: sha256:7254254afafd44c850940445c0480e449fea73a169aa067389252fef35bd7a3f Status: Downloaded newer image for registry.access.redhat.com/ubi8/ubi:latest registry.access.redhat.com/ubi8/ubi:latest
docker runを使用した場合
> docker run -it registry.access.redhat.com/ubi8/ubi Unable to find image 'registry.access.redhat.com/ubi8/ubi:latest' locally latest: Pulling from ubi8/ubi 296e14ee2414: Pull complete 356f18f3a935: Pull complete Digest: sha256:7254254afafd44c850940445c0480e449fea73a169aa067389252fef35bd7a3f Status: Downloaded newer image for registry.access.redhat.com/ubi8/ubi:latest
docker runを実行すると以下の様になります。


実行後にコンテナが動作したときにバージョン情報を確認すると以下の様になります。うまくRHEL8が導入できました。

Docker Desktop側の画面にも反映されています。


おわりに
初めてRHELの導入をしてみたのですが、情報が少ないので少し苦労しましたがやってみるとすんなりで導入できました。コンテナの種類もたくさんあったので 必要なアプリケーションの導入されたものを探せばかなり負担は減りそうですね。