Podman : Use by common users2022/03/14 |
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 [cent] user [root@dlp ~]# cat /etc/subuid cent:100000:65536 [root@dlp ~]# cat /etc/subgid cent: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 cent:100000:65536 centos:165536:65536 redhat:231072:65536 cent:100000:65536 centos:165536:65536 redhat:231072:65536 |
[2] | It's possible to run [podman] by common users. |
[centos@dlp ~]$ podman pull centos:stream9 [centos@dlp ~]$ podman images REPOSITORY TAG IMAGE ID CREATED SIZE quay.io/centos/centos stream9 44ffcc4acee8 3 days ago 152 MB
[centos@dlp ~]$
podman run centos:stream9 echo "run rootless containers" run rootless containers # containers related files are located under the [$HOME/.local] directory [centos@dlp ~]$ ll ~/.local/share/containers/storage total 8 -rw-r--r--. 1 centos centos 3 Mar 14 12:52 defaultNetworkBackend drwx------. 2 centos centos 27 Mar 14 12:52 libpod drwx------. 2 centos centos 6 Mar 14 12:52 mounts drwx------. 5 centos centos 185 Mar 14 12:53 overlay drwx------. 3 centos centos 124 Mar 14 12:53 overlay-containers drwx------. 3 centos centos 116 Mar 14 12:52 overlay-images drwx------. 2 centos centos 129 Mar 14 12:53 overlay-layers -rw-r--r--. 1 centos centos 64 Mar 14 12:53 storage.lock drwx------. 2 centos centos 6 Mar 14 12:52 tmp -rw-r--r--. 1 centos centos 0 Mar 14 12:52 userns.lock # possible to create Pods [centos@dlp ~]$ podman pod create -p 8081:80 -n test-pod [centos@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 [centos@dlp ~]$ podman run -d -p 1023:80 srv.world/centos-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/centos-nginx [centos@dlp ~]$ podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 96a4f51834c0 srv.world/centos-nginx:latest /usr/sbin/nginx -... 4 seconds ago Up 5 seconds ago 0.0.0.0:1024->80/tcp gallant_pascal |
Sponsored Link |