Podman : Use by common users2022/05/24 |
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 [fedora] user [root@dlp ~]# cat /etc/subuid fedora:100000:65536 [root@dlp ~]# cat /etc/subgid fedora: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 redhat [root@dlp ~]# useradd centos [root@dlp ~]# cat /etc/subgid /etc/subgid fedora:100000:65536 redhat:165536:65536 centos:231072:65536 fedora:100000:65536 redhat:165536:65536 centos:231072:65536 |
[2] | It's possible to run [podman] by common users. |
[fedora@dlp ~]$ podman pull fedora [fedora@dlp ~]$ podman images REPOSITORY TAG IMAGE ID CREATED SIZE registry.fedoraproject.org/fedora latest 750037c05cfe 3 months ago 159 MB
[fedora@dlp ~]$
podman run fedora echo "run rootless containers" run rootless containers # containers related files are located under the [$HOME/.local] directory [fedora@dlp ~]$ ll ~/.local/share/containers/storage total 16 -rw-r--r--. 1 fedora fedora 8 May 24 11:45 defaultNetworkBackend drwx------. 2 fedora fedora 27 May 24 11:45 libpod drwx------. 2 fedora fedora 6 May 24 11:45 mounts drwx------. 2 fedora fedora 27 May 24 11:45 networks drwx------. 6 fedora fedora 4096 May 24 12:38 overlay drwx------. 3 fedora fedora 124 May 24 12:38 overlay-containers drwx------. 4 fedora fedora 188 May 24 11:50 overlay-images drwx------. 2 fedora fedora 4096 May 24 12:38 overlay-layers -rw-r--r--. 1 fedora fedora 64 May 24 12:38 storage.lock drwx------. 2 fedora fedora 6 May 24 11:45 tmp -rw-r--r--. 1 fedora fedora 0 May 24 11:45 userns.lock # possible to create Pods [fedora@dlp ~]$ podman pod create -p 8081:80 -n test-pod [fedora@dlp ~]$ podman pod ls POD ID NAME STATUS CREATED INFRA ID # OF CONTAINERS 0d14d0e43e5b test-pod Created 5 seconds ago 2796b5c988f5 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 [fedora@dlp ~]$ podman run -d -p 1023:80 docker.io/library/nginx 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 -d -p 1024:80 docker.io/library/nginx [fedora@dlp ~]$ podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 54deee01e114 docker.io/library/nginx:latest nginx -g daemon o... 5 seconds ago Up 5 seconds ago 0.0.0.0:1024->80/tcp peaceful_bell |
Sponsored Link |