Skip to content

Beszel: single host agent

Beszel combines a monitoring server and agent in one Docker container, ideal for local host oversight without external dependencies. This guide walks through Docker Compose setup, key retrieval, firewall considerations, and health checks for a standalone deployment.

Installation via Docker Compose

Create docker-compose.yml in your working directory:

version: "3.9"
services:
  beszel:
    image: beszel/beszel
    container_name: beszel
    restart: unless-stopped
    ports:
      - "8080:8080"
      - "2000:2000/udp"
    environment:
      - TZ=UTC
    volumes:
      - beszel_data:/root/.beszel
volumes:
  beszel_data: {}

Apply the configuration:

docker compose up -d

After startup the container listens on HTTP port 8080 and UDP 2000 for agent communication. Config volume and database footprint are minimal, typical for this class of self‑hosted tools.

First launch and key retrieval

Open http://<host-ip>:8080 in a browser. The welcome screen shows a key input field or QR code. The key can also be fetched from the container:

docker exec beszel cat /root/.beszel/key.txt

or via logs:

docker logs beszel 2>&1 | grep -i key

The first run creates a local database inside the volume and generates a unique identifier for the instance. Save the key—it’s required for the next agent connection step.

Basic configuration and access

To run the agent separately (or on the same host with another container), use the same image with the KEY environment variable:

docker run -d \
  --name beszel-agent \
  -e KEY=YOUR_GENERATED_KEY \
  -e TZ=UTC \
  beszel/beszel \
  --agent

UI access remains http://host:8080. The interface lists connected agents, uptime, CPU and memory load. Timezone or log paths can be changed via env vars on container recreation.

Tip

When using SELinux or AppArmor, container labels or socket access may need adjustment. Usually a restart with --privileged suffices only for auto‑resource detection; otherwise keep standard restrictions.

Typical error: port and firewall

Access issues or missing agent data often stem from host‑system firewall blocks. Below is the typical port scheme and commands for common firewalls:

DirectionPortProtocolPurpose
Incoming8080TCPWeb UI
In/Out2000UDPAgent heartbeat & metrics

UFW:

sudo ufw allow 8080/tcp
sudo ufw allow 2000/udp

FirewallD (CentOS/RHEL):

sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --permanent --add-port=2000/udp
sudo firewall-cmd --reload

If data still doesn’t appear, check for restrictive Docker network policies (docker network inspect) or Carrier‑Grade NAT blocking UDP traffic on the provider side.

Warning

Missing UDP access to 2000 makes the agent unavailable to the server: metrics won’t be sent and the UI may show an empty host list. Always verify the rule with sudo netstat -tulnp | grep 2000 inside the container after restart.

Check functionality

Verify containers are running and port 8080 is reachable:

docker compose ps
# or
curl -s http://localhost:8080/api/health

A successful response returns JSON with status ok. To check the agent running separately:

docker exec beszel-agent beszel-agent --check

In the UI you should see the host name with current CPU/memory values. If the agent is absent, repeat launch with the correct KEY and confirm the UDP‑2000 rule is active on the host.

A quick availability check script:

#!/bin/bash
HOST="127.0.0.1"
if curl -s -o /dev/null -w "%{http_code}" "http://$HOST:8080/api/health" | grep -q "2"; then
  echo "Beszel UI OK"
else
  echo "Beszel UI unreachable"
fi
if nc -zzu $HOST 2000; then
  echo "UDP 2000 open"
else
  echo "UDP 2000 blocked"
fi