Podman : 一般ユーザーで利用する2026/05/07 |
|
一般ユーザーでも [Podman] コマンドは利用可能です。 |
|
| [1] | デフォルトで、ユーザー名前空間で使用される サブ UID/GID が一般ユーザーに割り当てられます。 |
|
# サブ UID/GID マッピング ファイルは以下 # [100000:65536] ⇒ [ubuntu] ユーザーは コンテナー内では # 100000~165535 (100000 + 65536 - 1) の間の UID がプロセスの実行に使用される root@dlp:~# cat /etc/subuid ubuntu:100000:65536 root@dlp:~# cat /etc/subgid ubuntu:100000:65536 # ユーザーを新規追加すると サブ UID/GID マッピング ファイルにも自動で登録される # コンテナー内でプロセスの実行に使用される UID が各ユーザー間で重複しないように # n=0, n++ とすると # [開始 UID/GID = 100000 + (65536 * n)] # [終了 UID/GID = (開始 UID/GID) + 65536 - 1] となる root@dlp:~# useradd resolute root@dlp:~# useradd raccoon root@dlp:~# cat /etc/subgid /etc/subgid ubuntu:100000:65536 resolute:165536:65536 raccoon:231072:65536 ubuntu:100000:65536 resolute:165536:65536 raccoon:231072:65536 |
| [2] | 一般ユーザーで [podman] 使用可能です。 |
|
ubuntu@dlp:~$ podman pull ubuntu ubuntu@dlp:~$ podman images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/library/ubuntu latest 30ba44506a6d 2 weeks ago 111 MB
ubuntu@dlp:~$
podman run ubuntu echo "run rootless containers" run rootless containers # コンテナー関連ファイルは [$HOME/.local] 配下に保存される ubuntu@dlp:~$ ll ~/.local/share/containers/storage total 168 drwx------ 9 ubuntu ubuntu 4096 May 7 01:02 ./ drwx------ 4 ubuntu ubuntu 4096 May 7 00:58 ../ -rw-r--r-- 1 ubuntu ubuntu 126976 May 7 01:02 db.sql -rw-r--r-- 1 ubuntu ubuntu 8 May 7 00:58 defaultNetworkBackend drwx------ 2 ubuntu ubuntu 4096 May 7 00:58 libpod/ drwx------ 2 ubuntu ubuntu 4096 May 7 00:58 networks/ drwx------ 6 ubuntu ubuntu 4096 May 7 01:02 overlay/ drwx------ 3 ubuntu ubuntu 4096 May 7 01:02 overlay-containers/ drwx------ 3 ubuntu ubuntu 4096 May 7 00:58 overlay-images/ drwx------ 2 ubuntu ubuntu 4096 May 7 01:02 overlay-layers/ -rw-r--r-- 1 ubuntu ubuntu 64 May 7 01:02 storage.lock -rw-r--r-- 1 ubuntu ubuntu 0 May 7 00:58 userns.lock drwx------ 2 ubuntu ubuntu 4096 May 7 00:58 volumes/ # Pod も作成可 ubuntu@dlp:~$ podman pod create -p 8081:80 -n test-pod ubuntu@dlp:~$ podman pod ls POD ID NAME STATUS CREATED INFRA ID # OF CONTAINERS b214e57bf970 test-pod Created 3 seconds ago 4a3c790da7bb 1 # ポートマッピングについては # 一般ユーザーでは ホスト側の [1024] 未満のポートは使用不可 # [1024] 以上は使用可 ubuntu@dlp:~$ podman run -itd -p 1023:80 ubuntu /bin/bash Error: pasta failed with exit code 1: Listen failed for HOST TCP port */1023: Permission denied Couldn't listen on requested TCP ports podman run -itd -p 1024:80 ubuntu /bin/bash ubuntu@dlp:~$ podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 8f62109469b6 docker.io/library/ubuntu:latest /bin/bash 3 seconds ago Up 4 seconds 0.0.0.0:1024->80/tcp peaceful_maxwell |
| Sponsored Link |