How can I use podman to run a wayland app

I want to use bumblebee. Its a status bar for wayland written in python. How can I run this from a container and have it display on my silver blue desktop?

1 Like

So it turns out the app I was using just uses stdout and sway handles rendering of the bar. In this case at least the below was enough. Hopefully my solution will help some folks with podman usage anyway.

Docker file

FROM python:3
COPY ../bumblebee-status /bumblebee-status
RUN pip3 install psutil requests netifaces 
CMD python3 ./bumblebee-status/bumblebee-status -m cpu

swaybar config:

bar {
    colors {
        background #1d2021
        statusline #ebdbb2
    }
    font xft:Inconsolata 12
    status_command podman run 1c3927f6ac94
}
1 Like

To run wayland/x11/pulseaudio enabled containers with podman I’ve been using these arguments:

args=(
    # Disable SELinux label to enable mounting runtime socket
    --security-opt label=disable
    # Enable legacy X11
    -v /tmp/.X11-unix/:/tmp/.X11-unix/
    -e DISPLAY=:0
    # Enable xdg runtime for wayland and pulseaudio socket  
    -v /run/user/1000/:/run/user/1000/
    -e XDG_RUNTIME_DIR=/run/user/1000
    -e PULSE_SERVER=/run/user/1000/pulse/native
    # fix XError bad access
    --ipc host
)
podman run ${args[@]} ...
6 Likes

This is awesome can’t wait to try it out!

very good answer @tdecacqu, thanks for it!

It works well with root, however if I create a container as non-root user (uid 1010, gid1010), I got:

Unable to init server: Could not connect: Connection refused
Error: cannot open display: :0

if I check $DISPLAY from both users (root and non-root) I get the same:

echo $DISPLAY
:0

Any idea why it behaves differently for root and non-root?

@xhudik Non-root container may use a special user namespace (userns) which can result in file permission issues. You can check from the container who is the owner of the socket, e.g. can you read/write /tmp/.X11-unix/X0 ? If not, then you need to use extra arguments to authorize that, for example if your host user uid is 1000, then add:

--uidmap 1000:0:1
--uidmap 0:1:1000
--uidmap 1001:1001:64535

Or perhaps using --userns host may works too.

hmm, still no joy - with your uid mappings I got error :frowning: :

Error: chown `/dev/pts/0`: Invalid argument: OCI runtime error
or
Error: writing file `/proc/12177/gid_map`: Operation not permitted: OCI runtime permission denied error