- 追加された行はこの色です。
- 削除された行はこの色です。
#author("2020-05-12T15:50:08+00:00","default:haikikyou","haikikyou")
#author("2020-05-13T15:07:04+00:00","default:haikikyou","haikikyou")
[[日記]]
先日はmacOS上でpodman-machineからLinuxコンテナ環境を作成してpodmanでコンテナイメージを実行できることを確認した。~
[[日記/2020-05-07]]
今回は、RHELのコンテナイメージ(UBI)を試しに実行してみる。~
コンテナイメージの利用についてはページ末尾の参考リンクを参照のこと。~
どのように利用できるか、については以下の資料が分かり易く説明されている。
&label(warn){参考}; https://speakerdeck.com/moriwaka/ubi-faq
podman-machineを実行してLinuxコンテナ実行環境にsshでログインする。
#geshi{{{
$ podman-machine start podman-box
Starting "podman-box"...
(podman-box) Check network to re-create if needed...
(podman-box) Waiting for an IP...
Machine "podman-box" was started.
Waiting for SSH to be available...
Detecting the provisioner...
Started machines may have new IP addresses. You may need to re-run the `podman-machine env` command.
$ podman-machine ssh podman-box
.---. b o o t 2 mm https://podman.io
/o o\ ##
__(= " =)__ ##m###m m####m m###m## ####m##m m#####m ##m####m
//\'-=-'/\\ ##" "## ##" "## ##" "## ## ## ## " mmm## ##" ##
) ( ## ## ## ## ## ## ## ## ## m##"""## ## ##
/ \ ###mm##" "##mm##" "##mm### ## ## ## ##mmm### ## ##
____/ / \ \____ ## """ """" """ "" "" "" "" """" "" "" ""
`------'`"`'------' ## art: jgs
tc@podman-box:~$
}}}
続いてコンテナイメージを検索してみる。
#geshi{{{
tc@podman-box:~$ podman search registry.redhat.io/ubi8
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
redhat.io registry.redhat.io/ubi8 The Universal Base Image is designed and eng... 0
redhat.io registry.redhat.io/ubi8/ubi Provides the latest release of the Red Hat U... 0
redhat.io registry.redhat.io/ubi8/ubi-minimal Provides the latest release of the Minimal R... 0
redhat.io registry.redhat.io/ubi8/ubi-init Provides the latest release of the Red Hat U... 0
redhat.io registry.redhat.io/ubi8-minimal The Universal Base Image Minimal is a stripp... 0
redhat.io registry.redhat.io/ubi8/nodejs-12 Platform for building and running Node.js 12... 0
redhat.io registry.redhat.io/ubi7/ubi The Universal Base Image is designed and eng... 0
redhat.io registry.redhat.io/ubi8-init The Universal Base Image Init is designed to... 0
redhat.io registry.redhat.io/ubi7-init The Universal Base Image Init is designed to... 0
redhat.io registry.redhat.io/ubi7/ubi-minimal The Universal Base Image Init is designed to... 0
redhat.io registry.redhat.io/ubi7/ubi-init The Universal Base Image Init is designed to... 0
redhat.io registry.redhat.io/ubi7 The Universal Base Image is designed and eng... 0
redhat.io registry.redhat.io/ubi7-minimal The Universal Base Image Minimal is a stripp... 0
redhat.io registry.redhat.io/ubi8/go-toolset Platform for building and running Go 1.11.5 ... 0
redhat.io registry.redhat.io/ubi8/s2i-core Base image which allows using of source-to-i... 0
redhat.io registry.redhat.io/ubi8/dotnet-21-runtime Provides the latest release of Red Hat Enter... 0
redhat.io registry.redhat.io/ubi8/openjdk-8 Source To Image (S2I) image for Red Hat Open... 0
redhat.io registry.redhat.io/ubi8/openjdk-11 Source To Image (S2I) image for Red Hat Open... 0
redhat.io registry.redhat.io/ubi8/dotnet-31-runtime .NET Core 3.1 runtime only on RHEL 8 0
redhat.io registry.redhat.io/ubi8/dotnet-31 .NET Core 3.1 SDK and Runtime on RHEL 8 0
redhat.io registry.redhat.io/ubi8/php-72 Platform for building and running PHP 7.2 ap... 0
redhat.io registry.redhat.io/ubi8/s2i-base Base image with essential libraries and tool... 0
redhat.io registry.redhat.io/ubi8/perl-526 Platform for building and running Perl 5.26 ... 0
redhat.io registry.redhat.io/ubi8/nodejs-10 Platform for building and running Node.js 10... 0
redhat.io registry.redhat.io/ubi8/ruby-25 Platform for building and running Ruby 2.5 a... 0
}}}
goやjdk、phpなどの実行環境がプリインストールされたイメージもあるようだ。~
ubi-minimalというコンテナイメージをpullしてみる。
#geshi{{{
tc@podman-box:~$ podman pull registry.redhat.io/ubi8/ubi-minimal
Trying to pull registry.redhat.io/ubi8/ubi-minimal...
Getting image source signatures
Copying blob 1b99828eddf5 done
Copying blob e96e3a1df3b2 done
Copying config 401e359e0f [======================================] 4.2KiB / 4.2KiB
Writing manifest to image destination
Storing signatures
401e359e0f45bfdcf004e258b72e253fd07fba8cc5c6f2ed4f4608fb119ecc2c
}}}
コンテナのサイズを見てみると、ubi8に比べて70Mほど小さいようだ。
*** コンテナサイズ [#zd4c379b]
今回試したバージョンのコンテナのサイズを見てみると、minimalはubi8に比べて70Mほど小さいようだ。
|~コンテナイメージ|~サイズ|h
|ubi|211 M|
|ubi-minimal |146 MB|
#geshi{{{
tc@podman-box:~$ podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/library/nginx 1.18 1857c2b71337 2 weeks ago 136 MB
registry.redhat.io/ubi8 latest 8e0b0194b7e1 2 weeks ago 211 MB
registry.redhat.io/ubi8/ubi-minimal latest 401e359e0f45 2 weeks ago 146 MB
}}}
bashを実行してみる。
#geshi{{{
tc@podman-box:~$ podman run -it registry.redhat.io/ubi8/ubi-minimal /bin/bash
[root@39ead9abd2af /]# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.2 (Ootpa)
[root@39ead9abd2af /]# ls /
bin boot dev etc home lib lib64 lost+found media mnt opt proc root run sbin srv sys tmp usr var
[root@39ead9abd2af /]# ls /etc/yum.repos.d/
ubi.repo
}}}
*** yum [#ad2b587f]
ubi-minimalでは、yumやdnfはプリインストールされていないようだ。
#geshi{{{
[root@00ac75f02869 /]# yum
bash: yum: command not found
[root@00ac75f02869 /]# dnf
bash: dnf: command not found
}}}
minimalでないubiのイメージの方には入っている。
#geshi{{{
[root@d7a3c8e09c33 /]# yum --version
4.2.17
Installed: dnf-0:4.2.17-6.el8.noarch at Thu Apr 23 05:14:10 2020
Built : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> at Tue Feb 18 13:20:38 2020
Installed: rpm-0:4.14.2-37.el8.x86_64 at Thu Apr 23 05:13:42 2020
Built : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> at Fri Feb 21 13:46:44 2020
}}}
rhelパッケージのインストールには、サブスクリプション登録が必要である。
&label(warn){参考};
- https://speakerdeck.com/moriwaka/ubi-faq
- https://rheb.hatenablog.com/entry/podman_on_centos7_with_ubi
- https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux/8/html/building_running_and_managing_containers/using_red_hat_universal_base_images_standard_minimal_and_runtimes