Podman : Use by common users2022/04/28 |
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:~# adduser jammy root@dlp:~# adduser jellyfish root@dlp:~# cat /etc/subgid /etc/subgid ubuntu:100000:65536 jammy:165536:65536 jellyfish:231072:65536 ubuntu:100000:65536 jammy:165536:65536 jellyfish: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 3f4714ee068a 6 days ago 80.3 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 40 drwx------ 9 ubuntu ubuntu 4096 Apr 28 07:15 ./ drwx------ 4 ubuntu ubuntu 4096 Apr 28 07:16 ../ drwx------ 2 ubuntu ubuntu 4096 Apr 28 07:15 libpod/ drwx------ 2 ubuntu ubuntu 4096 Apr 28 07:15 mounts/ drwx------ 5 ubuntu ubuntu 4096 Apr 28 07:16 overlay/ drwx------ 3 ubuntu ubuntu 4096 Apr 28 07:16 overlay-containers/ drwx------ 3 ubuntu ubuntu 4096 Apr 28 07:16 overlay-images/ drwx------ 2 ubuntu ubuntu 4096 Apr 28 07:16 overlay-layers/ -rw-r--r-- 1 ubuntu ubuntu 64 Apr 28 07:16 storage.lock drwx------ 2 ubuntu ubuntu 4096 Apr 28 07:15 tmp/ -rw-r--r-- 1 ubuntu ubuntu 0 Apr 28 07:15 userns.lock # 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 477f00ef3630 test-pod Created 2 seconds ago a09898b74a92 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 -d -p 1023:80 srv.world/ubuntu-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/ubuntu-nginx ubuntu@dlp:~$ podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1c960231dfed srv.world/ubuntu-nginx:latest /usr/sbin/nginx -... 6 seconds ago Up 6 seconds ago 0.0.0.0:1024->80/tcp priceless_engelbart |
Sponsored Link |