Ubuntu 24.04 Podman コンテナーイメージを登録する

環境
Ubuntu 24.04

1.公式からダウンロードした既存のイメージファイルのシステムに [apache2] をインストールして、[apache2] 入りのイメージを新規登録します。 コンテナーは [run] する毎に新しいものが生成されるため、コンテナー環境を最新化して [exit] した後に、直近のコンテナーを登録対象とします。
# 現在登録されているイメージ一覧を表示

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/library/ubuntu latest bf3dc08bfed0 5 days ago 78.7 MB
# podman images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/library/ubuntu latest bf3dc08bfed0 5 days ago 78.7 MB
# podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/library/ubuntu latest bf3dc08bfed0 5 days ago 78.7 MB

2.最新のイメージでコンテナーを起動し [apache2] をインストールする
# podman run ubuntu /bin/bash -c “apt-get update; apt-get -y install apache2"

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# podman ps -a | tail -1
8ba924511a1b docker.io/library/ubuntu:latest /bin/bash -c apt-... 26 seconds ago Exited (0) 8 seconds ago intelligent_haibt
# podman ps -a | tail -1 8ba924511a1b docker.io/library/ubuntu:latest /bin/bash -c apt-... 26 seconds ago Exited (0) 8 seconds ago intelligent_haibt
# podman ps -a | tail -1
8ba924511a1b docker.io/library/ubuntu:latest /bin/bash -c apt-... 26 seconds ago Exited (0) 8 seconds ago intelligent_haibt

3.[apache2] インストール済みイメージを登録

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# podman commit 8ba924511a1b tesr.ark/ubuntu-apache2
Getting image source signatures
Copying blob 80098e3d304c skipped: already exists
Copying blob 8b942a48c2d6 done |
Copying config 49d5083368 done |
Writing manifest to image destination
49d5083368637cec96e051ebe22f2b5776549eb9ad7dc2143f4d617896ec05f4
# podman commit 8ba924511a1b tesr.ark/ubuntu-apache2 Getting image source signatures Copying blob 80098e3d304c skipped: already exists Copying blob 8b942a48c2d6 done | Copying config 49d5083368 done | Writing manifest to image destination 49d5083368637cec96e051ebe22f2b5776549eb9ad7dc2143f4d617896ec05f4
# podman commit 8ba924511a1b tesr.ark/ubuntu-apache2
Getting image source signatures
Copying blob 80098e3d304c skipped: already exists
Copying blob 8b942a48c2d6 done   |
Copying config 49d5083368 done   |
Writing manifest to image destination
49d5083368637cec96e051ebe22f2b5776549eb9ad7dc2143f4d617896ec05f4

4.podman確認

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
tesr.ark/ubuntu-apache2 latest 49d508336863 26 seconds ago 226 MB
docker.io/library/ubuntu latest bf3dc08bfed0 5 days ago 78.7 MB
# podman images REPOSITORY TAG IMAGE ID CREATED SIZE tesr.ark/ubuntu-apache2 latest 49d508336863 26 seconds ago 226 MB docker.io/library/ubuntu latest bf3dc08bfed0 5 days ago 78.7 MB
# podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
tesr.ark/ubuntu-apache2 latest 49d508336863 26 seconds ago 226 MB
docker.io/library/ubuntu latest bf3dc08bfed0 5 days ago 78.7 MB

5.登録したイメージからコンテナーを生成し [apache2] 確認

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# podman run tesr.ark/ubuntu-apache2 /usr/bin/whereis apache2
apache2: /usr/sbin/apache2 /usr/lib/apache2 /etc/apache2 /usr/share/apache2
# podman run tesr.ark/ubuntu-apache2 /usr/bin/whereis apache2 apache2: /usr/sbin/apache2 /usr/lib/apache2 /etc/apache2 /usr/share/apache2
# podman run tesr.ark/ubuntu-apache2 /usr/bin/whereis apache2
apache2: /usr/sbin/apache2 /usr/lib/apache2 /etc/apache2 /usr/share/apache2

 

IT

Posted by arkgame