Podman inside unprivileged Alpine container fails to start

Sorry, I must've misremembered. It breaks (at least partially) things like top/htop/free and so on
Bash:
# free -h
               total        used        free      shared  buff/cache   available
Mem:           512Mi          0B       512Mi          0B          0B       512Mi
Swap:          512Mi          0B       512Mi
Thanks for investing time/effort into testing this. By the way, on debian you can use socket activation for the podman service saving memory unless needed. It also doesn't have this specific issue.
 
Last edited:
Sorry, I misremembered. It breaks (at least partially) things like top/htop/free and so on
Bash:
# free -h
               total        used        free      shared  buff/cache   available
Mem:           512Mi          0B       512Mi          0B          0B       512Mi
Swap:          512Mi          0B       512Mi
Thanks for investing time/effort into testing this. By the way, on debian you can use socket activation for the podman service saving memory unless needed. It also doesn't have this specific issue.
A workaround for the free -h command displaying incorrect memory statistics in an Alpine Linux LXC container is to install the procps with apk add procps, because the default busybox version of free fails to read cgroups right, but the procps version does. It also fixes top.

However, the podman stats still shows system ram as the upper limit. Proxmox does still enforce whatever you have your memory set as, so it is just a cosmetic thing in your stats.
Code:
ID            NAME                           CPU %       MEM USAGE / LIMIT  MEM %       NET IO         BLOCK IO    PIDS        CPU TIME    AVG CPU %
cb73a4dccacf  openspeedtest-openspeedtest-1  0.00%       12.16MB / 32.71GB  0.04%       1.64kB / 768B  0B / 0B     12          11.169ms    0.03%
5f1ce8fc06fc  portainer                      0.01%       18.5MB / 32.71GB   0.06%       1.86kB / 768B  0B / 0B     11          38.424ms    0.11%

alpinepodman:~# free
               total        used        free      shared  buff/cache   available
Mem:         2097152         761     2096388           0           3     2096391
Swap:        2097152           0     2097152

alpinepodman:~# top
top - 22:33:28 up 1 min,  0 users,  load average: 0.13, 0.16, 0.11
Tasks: 30 total, 1 running, 29 sleep, 0 d-sleep, 0 stopped, 0 zombie
%Cpu(s):  0.3 us,  0.2 sy,  0.0 ni, 99.5 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :   2048.0 total,   2047.3 free,      0.7 used,      0.0 buff/cache     
MiB Swap:   2048.0 total,   2048.0 free,      0.0 used.   2047.3 avail Mem

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                 
    693 root      20   0    7676   3872   2352 S   0.3   0.2   0:00.05 sshd-session                                                                           
    311 root      20   0    1632    456    404 S   0.0   0.0   0:00.00 udhcpc                                                                                 
      1 root      20   0    1632    764    716 S   0.0   0.0   0:00.00 init                                                                                   
    391 root      20   0    1636    788    736 S   0.0   0.0   0:00.00 crond                                                                                   
    363 root      20   0    1652    812    752 S   0.0   0.0   0:00.00 syslogd                                                                                 
    421 root      20   0 1281308  42644  23584 S   0.0   2.0   0:00.15 podman                                                                                 
    524 root      20   0   19036   1204    948 S   0.0   0.1   0:00.00 aardvark-dns                                                                           
    538 root      20   0    3356    780    648 S   0.0   0.0   0:00.00 conmon                                                                                 
    420 root      20   0    1036    504    412 S   0.0   0.0   0:00.00 supervise-daemo                                                                         
    547 101       20   0  111968   4784   3364 S   0.0   0.2   0:00.00 nginx                                                                                   
    551 101       20   0  112876   2868    548 S   0.0   0.1   0:00.00 nginx                                                                                   
    552 101       20   0  112876   2868    548 S   0.0   0.1   0:00.00 nginx                                                                                   
    553 101       20   0  112876   2868    548 S   0.0   0.1   0:00.00 nginx                                                                                   
    555 101       20   0  112876   2868    548 S   0.0   0.1   0:00.00 nginx                                                                                   
    540 101       20   0    1636    664    596 S   0.0   0.0   0:00.00 entrypoint.sh                                                                           
    557 101       20   0  112876   2868    548 S   0.0   0.1   0:00.00 nginx                                                                                   
    558 101       20   0  112876   2868    548 S   0.0   0.1   0:00.00 nginx                                                                                   
    559 101       20   0  112876   2844    524 S   0.0   0.1   0:00.00 nginx                                                                                   
    615 root      20   0    3356    768    640 S   0.0   0.0   0:00.00 conmon                                                                                 
    617 root      20   0 1318876  43228  26272 S   0.0   2.1   0:00.03 portainer                                                                               
    656 root      20   0    6748   3132   2020 S   0.0   0.1   0:00.00 sshd                                                                                   
    663 root      20   0    1632    756    700 S   0.0   0.0   0:00.00 getty                                                                                   
    664 root      20   0    1632    728    676 S   0.0   0.0   0:00.00 getty                                                                                   
    665 root      20   0    1632    784    732 S   0.0   0.0   0:00.00 getty                                                                                   
    556 101       20   0  112876   2868    548 S   0.0   0.1   0:00.00 nginx                                                                                   
    689 101       20   0     864    336    292 S   0.0   0.0   0:00.00 crond                                                                                   
    691 root      20   0    7380   4240   3016 S   0.0   0.2   0:00.00 sshd-session                                                                           
    690 101       20   0    1624    580    528 S   0.0   0.0   0:00.00 tail                                                                                   
    694 root      20   0    1720   1072    876 S   0.0   0.1   0:00.00 sh                                                                                     
    711 root      20   0    4124   3036    984 R   0.0   0.1   0:00.00 top

The only way to fix the upper limits of the containers is to manually set the max memory and swap values for the container.
 
There's some very funky behavior in my case.
Bash:
# free -V; top -V; free -h; top -bn1 | awk 'NR>=4 && NR<=5'; podman run hello-world | head -n1; free -h; top -bn1 | awk 'NR>=4 && NR<=5'
free from procps-ng 4.0.5
top from procps-ng 4.0.5
               total        used        free      shared  buff/cache   available
Mem:            14Gi        11Gi       723Mi        76Mi       2.7Gi       2.6Gi
Swap:          5.8Gi        23Mi       5.8Gi
MiB Mem :  14860.2 total,    721.8 free,  12189.8 used,   2752.6 buff/cache
MiB Swap:   5944.1 total,   5920.8 free,     23.3 used.   2670.4 avail Mem
!... Hello Podman World ...!
               total        used        free      shared  buff/cache   available
Mem:           512Mi          0B       512Mi          0B          0B       512Mi
Swap:          512Mi          0B       512Mi
MiB Mem :    512.0 total,    512.0 free,      0.0 used,      0.0 buff/cache
MiB Swap:    512.0 total,    512.0 free,      0.0 used.    512.0 avail Mem
Please don't quote every message.
 
Last edited: