Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Podman container support? #211

Open
poVoq opened this issue Oct 18, 2024 · 6 comments
Open

Podman container support? #211

poVoq opened this issue Oct 18, 2024 · 6 comments
Labels
enhancement New feature or request in progress We've started work on this

Comments

@poVoq
Copy link

poVoq commented Oct 18, 2024

Would be nice if Podman containers could also be monitored with this.

Thanks!

@henrygd henrygd added the enhancement New feature or request label Oct 18, 2024
@giorgiga
Copy link

giorgiga commented Nov 9, 2024

Can you try setting DOCKER_HOST to /run/podman/podman.sock?

Could you also try leaving DOCKER_HOST unset and installing podman-docker?

@giorgiga
Copy link

giorgiga commented Nov 9, 2024

Actually, it seems podman does not create a socket per default.

IIUC it will be created if you start/enable the podman.socket service.

Starting it at the system level (systemctl enable --now podman.socket) will create /run/podman/podman.sock and starting it at the user level (systemctl --user enable --now podman.socket) will create it at /run/user/1000/podman/podman.sock (1000 is the userid, see the output of id).

I have no idea if the podman socket is compatible with the docker one and/or if Beszel will work with it: please share your discoveries (sorry for sorta using you as a guinea pig - I am packaging beszel for my distro and I'm not to the point where I can actually run it yet).

podman info | grep -A 2 remoteSocket should print the location of the user socket, the same command with sudo should print the location of the system one.

@henrygd
Copy link
Owner

henrygd commented Nov 10, 2024

Podman sock is not compatible. We would need to add a separate implementation for podman.

@giorgiga
Copy link

giorgiga commented Nov 11, 2024

The graphs (docker cpu/memory/network) show up with podman (on nixos and tumbleweed - I don't have other distros at hand)...

DOCKER_HOST needs to be set to unix:///run/podman/podman.sock or unix:///run/user/1000/podman/podman.sock (depending on who runs podman) and the user running the agent must have access to those sockets.

edit: I am running the agent directly on the host, not as a container

@henrygd
Copy link
Owner

henrygd commented Nov 11, 2024

Oh, interesting! Thanks for proving me wrong!

I was looking at the docs for the Libpod API, but apparently there's a Docker compatible API in addition to the Libpod API.

I should be able to add an automatic fallback to the podman.sock if docker.sock isn't active. And I'll change the verbiage in the hub to refer to Podman if that's being used instead of Docker.

@henrygd henrygd added the in progress We've started work on this label Nov 12, 2024
henrygd added a commit that referenced this issue Nov 12, 2024
@henrygd
Copy link
Owner

henrygd commented Nov 12, 2024

0.8.0 will be released soon with better Podman support.

If anyone more familiar with Podman has any tips or suggestions for improvement, please let me know.

Note that this is currently an either-or situation. You can either use the Podman API or the Docker API, but not both at the same time. If you need both, let me know and I'll add that functionality at some point.

Start and enable the Podman API

systemctl --user enable podman.socket
systemctl --user start podman.socket

Restart the agent to allow it to connect.

Permissions

You must run the agent as the same user that runs Podman. Run id -u to find your user ID, or run podman top -l to get the username for running containers.

beszel-agent.service example

# User=beszel
User=1000

podman run example

podman run -d --name=beszel-agent --network=host --user 1000 -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock -e KEY="..." henrygd/beszel-agent:latest

Specifying a different socket path

The agent checks for the Podman socket at /run/user/{uid}/podman/podman.sock.

If you need to use a different path, specify it in the DOCKER_HOST environment variable: DOCKER_HOST=unix:///path/to/podman.sock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request in progress We've started work on this
Projects
None yet
Development

No branches or pull requests

3 participants