Podman : Use by common users2023/03/01 |
It's possible to use Podman containers by common users.
|
|
[1] | By default, sub UID/GID that are used on user name spaces are asigned to run containers. |
# sub UID/GID mapping file # 100000 to 165535 (100000 + 65536 - 1) UID are used for running processes in containers on [alma] user [root@dlp ~]# cat /etc/subuid alma:100000:65536 [root@dlp ~]# cat /etc/subgid alma: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 centos [root@dlp ~]# useradd redhat [root@dlp ~]# cat /etc/subgid /etc/subgid alma:100000:65536 centos:165536:65536 redhat:231072:65536 alma:100000:65536 centos:165536:65536 redhat:231072:65536 |
[2] | It's possible to run [podman] by common users. |
[alma@dlp ~]$ podman pull almalinux [alma@dlp ~]$ podman images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/library/almalinux latest d3ffa43c2567 6 days ago 196 MB
[alma@dlp ~]$
podman run almalinux echo "run rootless containers" run rootless containers # containers related files are located under the [$HOME/.local] directory [alma@dlp ~]$ ll ~/.local/share/containers/storage total 8 -rw-r--r--. 1 alma alma 3 Mar 14 12:52 defaultNetworkBackend drwx------. 2 alma alma 27 Mar 14 12:52 libpod drwx------. 2 alma alma 6 Mar 14 12:52 mounts drwx------. 5 alma alma 185 Mar 14 12:53 overlay drwx------. 3 alma alma 124 Mar 14 12:53 overlay-containers drwx------. 3 alma alma 116 Mar 14 12:52 overlay-images drwx------. 2 alma alma 129 Mar 14 12:53 overlay-layers -rw-r--r--. 1 alma alma 64 Mar 14 12:53 storage.lock drwx------. 2 alma alma 6 Mar 14 12:52 tmp -rw-r--r--. 1 alma alma 0 Mar 14 12:52 userns.lock # possible to create Pods [alma@dlp ~]$ podman pod create -p 8081:80 -n test-pod [alma@dlp ~]$ podman pod ls POD ID NAME STATUS CREATED INFRA ID # OF CONTAINERS a31c8a738d9b test-pod Created 3 seconds ago b21c47fc9c00 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 [alma@dlp ~]$ podman run -d -p 1023:80 srv.world/almalinux-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 srv.world/almalinux-nginx [alma@dlp ~]$ podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 96a4f51834c0 srv.world/almalinux-nginx:latest /usr/sbin/nginx -... 4 seconds ago Up 5 seconds ago 0.0.0.0:1024->80/tcp gallant_pascal |
Sponsored Link |