Podman : Use by common users2025/04/22 |
It's possible to use Podman containers by common users. |
|
[1] | By default, sub UID/GID that are used on user name spaces are assigned to run containers. |
# sub UID/GID mapping file # 100000 to 165535 (100000 + 65536 - 1) UID are used for running processes in containers on [ubuntu] user root@dlp:~# cat /etc/subuid ubuntu:100000:65536 root@dlp:~# cat /etc/subgid ubuntu:100000:65536 # when added new users, sub UID/GID are also added # n=0, n++ # [start UID/GID = 100000 + (65536 * n)] # [end UID/GID = (start UID/GID) + 65536 - 1] root@dlp:~# useradd plucky root@dlp:~# useradd puffin root@dlp:~# cat /etc/subgid /etc/subgid ubuntu:100000:65536 plucky:165536:65536 puffin:231072:65536 ubuntu:100000:65536 plucky:165536:65536 puffin:231072:65536 |
[2] | It's possible to run [podman] by common users. |
ubuntu@dlp:~$ podman pull ubuntu ubuntu@dlp:~$ podman images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/library/ubuntu latest 602eb6fb314b 13 days ago 80.6 MB
ubuntu@dlp:~$
podman run ubuntu echo "run rootless containers" run rootless containers # containers related files are located under the [$HOME/.local] directory ubuntu@dlp:~$ ll ~/.local/share/containers/storage total 164 drwx------ 9 ubuntu ubuntu 4096 Apr 22 00:50 ./ drwx------ 4 ubuntu ubuntu 4096 Apr 22 00:50 ../ -rw-r--r-- 1 ubuntu ubuntu 122880 Apr 22 00:50 db.sql -rw-r--r-- 1 ubuntu ubuntu 8 Apr 22 00:50 defaultNetworkBackend drwx------ 2 ubuntu ubuntu 4096 Apr 22 00:50 libpod/ drwx------ 2 ubuntu ubuntu 4096 Apr 22 00:50 networks/ drwx------ 5 ubuntu ubuntu 4096 Apr 22 00:50 overlay/ drwx------ 3 ubuntu ubuntu 4096 Apr 22 00:50 overlay-containers/ drwx------ 3 ubuntu ubuntu 4096 Apr 22 00:50 overlay-images/ drwx------ 2 ubuntu ubuntu 4096 Apr 22 00:50 overlay-layers/ -rw-r--r-- 1 ubuntu ubuntu 64 Apr 22 00:50 storage.lock -rw-r--r-- 1 ubuntu ubuntu 0 Apr 22 00:50 userns.lock drwx------ 2 ubuntu ubuntu 4096 Apr 22 00:50 volumes/ # possible to create Pods 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 fe0ea39f1400 test-pod Created 3 seconds ago 211de5a73ebc 1 # for port mapping, # it's impossible to use less than [1024] ports on Host machine by common users # possible to use over [1024] ports ubuntu@dlp:~$ podman run -itd -p 1023:80 ubuntu /bin/bash Error: rootlessport cannot expose privileged port 1023, you can add 'net.ipv4.ip_unprivileged_port_start=1023' to /etc/sysctl.conf (currently 1024), or choose a larger port number (>= 1024): listen tcp 0.0.0.0:1023: bind: permission denied podman run -itd -p 1024:80 ubuntu /bin/bash ubuntu@dlp:~$ podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 99515000c3b3 docker.io/library/ubuntu:latest /bin/bash 3 seconds ago Up 4 seconds 0.0.0.0:1024->80/tcp infallible_maxwell |
Sponsored Link |