Podman : インストール2025/10/31 |
|
コンテナー管理ツール Podman をインストールします。 |
|
| [1] | Podman をインストールします。 |
|
dlp:~ # zypper -n install podman
|
| [2] | openSUSE 公式イメージファイルをダウンロードし、コンテナーから echo を実行して [Welcome to the Podman World] を出力します。 |
|
# 公式イメージダウンロード dlp:~ # podman pull opensuse/leap Resolved "opensuse/leap" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf) Trying to pull registry.opensuse.org/opensuse/leap:latest... Getting image source signatures Copying blob 84af677f62da done | Copying config 004d9956dc done | Writing manifest to image destination 004d9956dc10a79b76f733edc68cb6ab8d3a4385b14c259848a8824110a7db36 # コンテナーで echo を実行 dlp:~ # podman run opensuse/leap /bin/echo "Welcome to the Podman World" Welcome to the Podman World |
| [3] | コンテナー環境の対話型シェルセッションに接続するには以下のように [-i] オプションと [-t] オプションを付加します。 コンテナー環境内で [exit] すると、ホストのコンソールに戻ってコンテナー環境のプロセスは終了します。 |
|
dlp:~ #
4c6e20757454:/ # podman run -it opensuse/leap /bin/bash 4c6e20757454:/ # # 接続できた
cat /etc/os-release NAME="openSUSE Leap" VERSION="15.6" ID="opensuse-leap" ID_LIKE="suse opensuse" VERSION_ID="15.6" PRETTY_NAME="openSUSE Leap 15.6" ANSI_COLOR="0;32" CPE_NAME="cpe:/o:opensuse:leap:15.6" BUG_REPORT_URL="https://bugs.opensuse.org" HOME_URL="https://www.opensuse.org/" DOCUMENTATION_URL="https://en.opensuse.org/Portal:Leap" LOGO="distributor-logo-Leap"4c6e20757454:/ # exit exit dlp:~ # # 戻った
|
| [4] | コンテナーをデーモンとして起動するには [-d] オプションを付加します。 |
|
dlp:~ # podman run -itd opensuse/leap /bin/bash 9bbb72db7dd48f30381e92c9bacc9c3a3a6384a637b6aea34db3ede019edd511 # podman プロセス表示 dlp:~ # podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 9bbb72db7dd4 registry.opensuse.org/opensuse/leap:latest /bin/bash 17 seconds ago Up 16 seconds bold_mccarthy # コンテナー環境に接続 dlp:~ # podman exec -it 9bbb72db7dd4 /bin/bash 9bbb72db7dd4:/ # # 接続できた 9bbb72db7dd4:/ # exit
# コンテナープロセスを終了する dlp:~ # podman kill 9bbb72db7dd4 dlp:~ # podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
| Sponsored Link |
|
|