Fedora 42
Sponsored Link

Podman : Use by common users2025/04/25

 

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.
# default name spaces number

[root@dlp ~]#
cat /proc/sys/user/max_user_namespaces

63771
# sub UID/GID mapping file
# 524288 to 589823 (524288 + 65536 - 1) UID are used for running processes in containers on [fedora] user

[root@dlp ~]#
cat /etc/subuid

fedora:524288:65536
[root@dlp ~]#
cat /etc/subgid

fedora:524288:65536
# when added new users, sub UID/GID are also added
# n=0, n++
# [start UID/GID = 524288 + (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:524288:65536
redhat:589824:65536
centos:655360:65536
fedora:524288:65536
redhat:589824:65536
centos:655360: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      83e6cd7bf121  About an hour ago  166 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 200
-rw-r--r--. 1 fedora fedora 122880 Apr 25 16:51 db.sql
-rw-r--r--. 1 fedora fedora      8 Apr 25 16:50 defaultNetworkBackend
drwx------. 2 fedora fedora      6 Apr 25 16:50 libpod
drwx------. 2 fedora fedora     27 Apr 25 16:50 networks
drwx------. 5 fedora fedora    185 Apr 25 16:51 overlay
drwx------. 3 fedora fedora    124 Apr 25 16:51 overlay-containers
drwx------. 3 fedora fedora    116 Apr 25 16:50 overlay-images
drwx------. 2 fedora fedora    129 Apr 25 16:51 overlay-layers
-rw-r--r--. 1 fedora fedora     64 Apr 25 16:51 storage.lock
-rw-r--r--. 1 fedora fedora      0 Apr 25 16:50 userns.lock
drwx------. 2 fedora fedora      6 Apr 25 16:50 volumes

# 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
43647bf3438d  test-pod    Created     3 seconds ago  762b069382d6  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: pasta failed with exit code 1:
Failed to bind port 1023 (Permission denied) for option '-t 1023-1023:80-80', exiting
[fedora@dlp ~]$
podman run -d -p 1024:80 docker.io/library/nginx

[fedora@dlp ~]$
podman ps

CONTAINER ID  IMAGE                           COMMAND               CREATED        STATUS        PORTS                 NAMES
bde39b411226  docker.io/library/nginx:latest  nginx -g daemon o...  3 seconds ago  Up 4 seconds  0.0.0.0:1024->80/tcp  funny_darwin
Matched Content