### Run Dozzle with Docker Compose Source: https://dozzle.dev/guide/what-is-dozzle/getting-started This Docker Compose configuration defines a service for Dozzle. It specifies the image, mounts the Docker socket, and maps port 8080. The example also includes commented-out environment variables to demonstrate how to enable advanced features like container actions, shell access, and authentication. ```yaml services: dozzle: image: amir20/dozzle:latest volumes: - /var/run/docker.sock:/var/run/docker.sock ports: - 8080:8080 environment: # Uncomment to enable container actions (stop, start, restart). See https://dozzle.dev/guide/actions # - DOZZLE_ENABLE_ACTIONS=true # # Uncomment to allow access to container shells. See https://dozzle.dev/guide/shell # - DOZZLE_ENABLE_SHELL=true # # Uncomment to enable authentication. See https://dozzle.dev/guide/authentication # - DOZZLE_AUTH_PROVIDER=simple ``` -------------------------------- ### Run Dozzle with Docker CLI Source: https://dozzle.dev/guide/what-is-dozzle/getting-started This command runs Dozzle as a detached Docker container. It mounts the Docker socket to allow Dozzle to interact with Docker and exposes port 8080 for accessing the Dozzle web interface. This is the simplest method to get Dozzle running quickly. ```sh docker run -d -v /var/run/docker.sock:/var/run/docker.sock -p 8080:8080 amir20/dozzle:latest ``` -------------------------------- ### Deploy Docker Swarm Stack Source: https://dozzle.dev/guide/what-is-dozzle/getting-started This command is used to deploy the Dozzle Docker Swarm stack. It takes the Docker Compose file (dozzle-stack.yml) and a chosen stack name as arguments, initiating the service deployment across the Swarm cluster based on the provided configuration. ```bash docker stack deploy -c dozzle-stack.yml ``` -------------------------------- ### Apply Kubernetes Configuration using Kubectl Source: https://dozzle.dev/guide/what-is-dozzle/getting-started This shell command uses `kubectl apply` to deploy the Kubernetes configurations defined in `k8s-dozzle.yml`. This command is essential for applying the ClusterRoleBinding and Deployment definitions to the Kubernetes cluster. ```sh kubectl apply -f k8s-dozzle.yml ``` -------------------------------- ### Example users.yml content for Docker Compose integration Source: https://dozzle.dev/guide/what-is-dozzle/authentication This YAML snippet provides an example of the `users.yml` file content, identical to the standalone version, intended for use when integrating Dozzle with Docker Compose for file-based authentication. ```yaml users: admin: email: me@email.net name: Admin password: $2a$11$9ho4vY2LdJ/WBopFcsAS0uORC0x2vuFHQgT/yBqZyzclhHsoaIkzK ``` -------------------------------- ### Kubernetes Deployment for Dozzle Application Source: https://dozzle.dev/guide/what-is-dozzle/getting-started This YAML defines a Kubernetes Deployment named "dozzle". It configures a single replica of the Dozzle application, using the "amir20/dozzle:latest" image, exposing port 8080, and setting the "DOZZLE_MODE" environment variable to "k8s". It also specifies the "pod-viewer" ServiceAccount for the pod. ```YAML apiVersion: apps/v1 kind: Deployment metadata: name: dozzle spec: replicas: 1 selector: matchLabels: app: dozzle template: metadata: labels: app: dozzle spec: serviceAccountName: pod-viewer containers: - name: dozzle image: amir20/dozzle:latest ports: - containerPort: 8080 env: - name: DOZZLE_MODE value: "k8s" ``` -------------------------------- ### Deploy Dozzle in Docker Swarm Mode Source: https://dozzle.dev/guide/what-is-dozzle/getting-started This Docker Compose file configures Dozzle for deployment across all nodes in a Docker Swarm cluster. It sets the DOZZLE_MODE to 'swarm', mounts the Docker socket, exposes port 8080, and defines an overlay network for inter-service communication. The 'global' deploy mode ensures Dozzle runs on every node. ```yaml services: dozzle: image: amir20/dozzle:latest environment: - DOZZLE_MODE=swarm volumes: - /var/run/docker.sock:/var/run/docker.sock ports: - 8080:8080 networks: - dozzle deploy: mode: global networks: dozzle: driver: overlay ``` -------------------------------- ### Kubernetes RBAC for Dozzle Pod Viewer Source: https://dozzle.dev/guide/what-is-dozzle/getting-started This Kubernetes configuration defines a ServiceAccount named 'pod-viewer' and a ClusterRole named 'pod-viewer-role'. The ClusterRole grants necessary permissions to get, list, and watch pods, pod logs, and nodes, as well as metrics for pods, enabling Dozzle to effectively monitor Kubernetes resources within the cluster. ```yaml apiVersion: v1 kind: ServiceAccount metadata: name: pod-viewer --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: pod-viewer-role rules: - apiGroups: [""] resources: ["pods", "pods/log", "nodes"] verbs: ["get", "list", "watch"] - apiGroups: ["metrics.k8s.io"] resources: ["pods"] verbs: ["get", "list"] ``` -------------------------------- ### Start Docker Socket Proxy with Minimal Access Source: https://dozzle.dev/guide/what-is-dozzle/remote-hosts This command runs the `tecnativa/docker-socket-proxy` container, exposing the `docker.sock` file without TLS. It's configured with minimal access rights, specifically enabling listing containers (`CONTAINERS=1`) and system information (`INFO=1`), which are necessary for Dozzle's functionality. ```sh docker container run --privileged -e CONTAINERS=1 -e INFO=1 -v /var/run/docker.sock:/var/run/docker.sock -p 2375:2375 tecnativa/docker-socket-proxy ``` -------------------------------- ### Configure Dozzle to Connect to a Single Remote Host Source: https://dozzle.dev/guide/what-is-dozzle/remote-hosts These examples demonstrate how to run Dozzle and connect it to a remote Docker host. You can achieve this either directly via the CLI using the `--remote-host` flag or by defining the `DOZZLE_REMOTE_HOST` environment variable within a Docker Compose setup. ```sh docker run -p 8080:8080 amir20/dozzle --remote-host tcp://123.1.1.1:2375 ``` ```yaml services: dozzle: image: amir20/dozzle:latest ports: - 8080:8080 environment: DOZZLE_REMOTE_HOST: tcp://123.1.1.1:2375 ``` -------------------------------- ### Kubernetes ClusterRoleBinding for Pod Viewer Source: https://dozzle.dev/guide/what-is-dozzle/getting-started This YAML defines a Kubernetes ClusterRoleBinding named "pod-viewer-binding". It binds the "pod-viewer" ServiceAccount in the "default" namespace to the "pod-viewer-role" ClusterRole, granting it permissions to view pods across the cluster. ```YAML apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: pod-viewer-binding subjects: - kind: ServiceAccount name: pod-viewer namespace: default roleRef: kind: ClusterRole name: pod-viewer-role apiGroup: rbac.authorization.k8s.io ``` -------------------------------- ### Install Kubernetes Metrics API Server Source: https://dozzle.dev/guide/what-is-dozzle/k8s This command installs the Kubernetes Metrics API server, which is a prerequisite for Dozzle to retrieve resource usage information from pods. It applies the official components YAML from the Kubernetes SIGs Metrics Server GitHub repository. ```bash kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml ``` -------------------------------- ### Docker CLI Example for Custom Container Grouping Source: https://dozzle.dev/guide/what-is-dozzle/container-groups This example demonstrates how to run a Docker container and assign it to a custom group named 'myapp' using the `dev.dozzle.group` label. This allows Dozzle to group the container in its UI. ```Shell docker run --label dev.dozzle.group=myapp hello-world ``` -------------------------------- ### Example users.yml file content for Dozzle authentication Source: https://dozzle.dev/guide/what-is-dozzle/authentication This YAML snippet shows the structure of the `users.yml` file used by Dozzle for file-based user management. It defines a user 'admin' with an email, name, and a bcrypt-hashed password. The `filter` field is optional. ```yaml users: # "admin" here is username admin: email: me@email.net name: Admin # Generate with docker run -it --rm amir20/dozzle generate --name Admin --email me@email.net --password secret admin password: $2a$11$9ho4vY2LdJ/WBopFcsAS0uORC0x2vuFHQgT/yBqZyzclhHsoaIkzK filter: ``` -------------------------------- ### Docker Compose Configuration for Dozzle, Authelia, and Traefik Integration Source: https://dozzle.dev/guide/what-is-dozzle/authentication This YAML configuration defines a multi-service Docker setup for integrating Dozzle with Authelia and Traefik. It orchestrates containers for Authelia (authentication), Traefik (reverse proxy), and Dozzle (log viewer), setting up networking, volumes, and Traefik labels for routing and authentication middleware. This setup enables secure access to Dozzle via Authelia's forward authentication. ```yaml networks: net: driver: bridge services: authelia: image: authelia/authelia container_name: authelia volumes: - ./authelia:/config networks: - net labels: - "traefik.enable=true" - "traefik.http.routers.authelia.rule=Host(`authelia.example.com`)" - "traefik.http.routers.authelia.entrypoints=https" - "traefik.http.routers.authelia.tls=true" - "traefik.http.routers.authelia.tls.options=default" - "traefik.http.middlewares.authelia.forwardauth.address=http://authelia:9091/api/verify?rd=https://authelia.example.com" - "traefik.http.middlewares.authelia.forwardauth.trustForwardHeader=true" - "traefik.http.middlewares.authelia.forwardauth.authResponseHeaders=Remote-User,Remote-Groups,Remote-Name,Remote-Email" expose: - 9091 restart: unless-stopped traefik: image: traefik:2.10.5 container_name: traefik volumes: - ./traefik:/etc/traefik - /var/run/docker.sock:/var/run/docker.sock networks: - net labels: - "traefik.enable=true" - "traefik.http.routers.api.rule=Host(`traefik.example.com`)" - "traefik.http.routers.api.entrypoints=https" - "traefik.http.routers.api.service=api@internal" - "traefik.http.routers.api.tls=true" - "traefik.http.routers.api.tls.options=default" - "traefik.http.routers.api.middlewares=authelia@docker" ports: - "80:80" - "443:443" command: - "--api" - "--providers.docker=true" - "--providers.docker.exposedByDefault=false" - "--providers.file.filename=/etc/traefik/certificates.yml" - "--entrypoints.http=true" - "--entrypoints.http.address=:80" - "--entrypoints.http.http.redirections.entrypoint.to=https" - "--entrypoints.http.http.redirections.entrypoint.scheme=https" - "--entrypoints.https=true" - "--entrypoints.https.address=:443" - "--log=true" - "--log.level=DEBUG" dozzle: image: amir20/dozzle:latest networks: - net environment: DOZZLE_AUTH_PROVIDER: forward-proxy volumes: - /var/run/docker.sock:/var/run/docker.sock labels: - "traefik.enable=true" - "traefik.http.routers.dozzle.rule=Host(`dozzle.example.com`)" - "traefik.http.routers.dozzle.entrypoints=https" - "traefik.http.routers.dozzle.tls=true" - "traefik.http.routers.dozzle.tls.options=default" - "traefik.http.routers.dozzle.middlewares=authelia@docker" expose: - 8080 restart: unless-stopped ``` -------------------------------- ### Configure Dozzle to Connect to Labeled Remote Hosts Source: https://dozzle.dev/guide/what-is-dozzle/remote-hosts These snippets illustrate how to assign custom labels to remote Docker hosts when configuring Dozzle, which helps in identifying them within the Dozzle UI. Examples are provided for both CLI and Docker Compose setups, including connecting to multiple labeled hosts. ```sh docker run --volume=/var/run/docker.sock:/var/run/docker.sock -p 8080:8080 amir20/dozzle --remote-host tcp://123.1.1.1:2375|foobar.com ``` ```yaml services: dozzle: image: amir20/dozzle:latest volumes: - /var/run/docker.sock:/var/run/docker.sock - /path/to/certs:/certs ports: - 8080:8080 environment: DOZZLE_REMOTE_HOST: tcp://167.99.1.1:2376|foo.com,tcp://167.99.1.2:2376|bar.com ``` -------------------------------- ### Count Total Log Entries with SQL Source: https://dozzle.dev/guide/what-is-dozzle/sql-engine This example SQL query demonstrates how to count the total number of log entries present in the `logs` table, providing a quick overview of the dataset size. ```sql SELECT COUNT(*) FROM logs ``` -------------------------------- ### Docker Compose Example for Custom Container Grouping Source: https://dozzle.dev/guide/what-is-dozzle/container-groups This Docker Compose example shows how to define a service and apply the `dev.dozzle.group` label to it, assigning the container to the 'myapp' group. Dozzle will use this label for UI grouping. ```YAML services: dozzle: image: hello-world labels: - dev.dozzle.group=myapp ``` -------------------------------- ### Enable Dozzle Container Actions with Docker Run Command Source: https://dozzle.dev/guide/what-is-dozzle/actions This `docker run` command starts the Dozzle container, mounting the Docker socket for container management. It explicitly enables the container actions feature by passing the `--enable-actions` flag, allowing users to start, stop, and restart containers directly from the Dozzle UI. ```sh docker run --volume=/var/run/docker.sock:/var/run/docker.sock -p 8080:8080 amir20/dozzle --enable-actions ``` -------------------------------- ### Fixing Dozzle Host Not Found Error for Podman Source: https://dozzle.dev/guide/what-is-dozzle/faq This guide resolves the 'host not found' error, primarily affecting Podman users, by ensuring a unique engine-id file exists. It provides shell commands to create the necessary directory and generate a UUID for the engine-id file. ```shell mkdir -p /var/lib/docker uuidgen > engine-id ``` -------------------------------- ### Configure Dozzle Container Filtering Source: https://dozzle.dev/guide/what-is-dozzle/filters These examples demonstrate how to apply filters to Dozzle to limit the containers it can see. Filters can be set using the `--filter` command-line argument for `docker run` or the `DOZZLE_FILTER` environment variable in a `docker-compose.yml` file. Common filters include `name` or `label`. ```sh docker run --volume=/var/run/docker.sock:/var/run/docker.sock -p 8080:8080 amir20/dozzle --filter label=color ``` ```yaml services: dozzle: image: amir20/dozzle:latest volumes: - /var/run/docker.sock:/var/run/docker.sock ports: - 8080:8080 environment: DOZZLE_FILTER: label=color ``` -------------------------------- ### Configure Dozzle Debug Logging with Docker Compose Source: https://dozzle.dev/guide/what-is-dozzle/debugging This `docker-compose.yml` example demonstrates how to set the `DOZZLE_LEVEL` environment variable to `debug` for the Dozzle service. This configuration enables more detailed logging output, mounts the Docker socket for container access, and exposes port 8080 for the Dozzle UI. ```yaml services: dozzle: image: amir20/dozzle:latest volumes: - /var/run/docker.sock:/var/run/docker.sock ports: - 8080:8080 environment: DOZZLE_LEVEL: debug ``` -------------------------------- ### Mounting Local Log Files with Alpine for Dozzle Source: https://dozzle.dev/guide/what-is-dozzle/log-files-on-disk Dozzle reads any output stream. This can be used in combination with Alpine to `tail` a mounted file. This snippet provides examples for both a one-off `docker run` command and a persistent `docker-compose` service to follow host log files. ```sh docker run -v /var/log/system.log:/var/log/test.log alpine tail -f /var/log/test.log ``` ```yaml services: dozzle-from-file: container_name: dozzle-from-file image: alpine volumes: - /var/log/system.log:/var/log/stream.log command: - tail - -f - /var/log/stream.log network_mode: none restart: unless-stopped ``` -------------------------------- ### Group Logs and Count by Field Source: https://dozzle.dev/guide/what-is-dozzle/sql-engine This example SQL query shows how to group log entries by a specific field, such as 'level', and then count the occurrences within each group. This is useful for summarizing log data by category. ```sql SELECT level, COUNT(*) FROM logs GROUP BY level ``` -------------------------------- ### Configure Dozzle Hostname Source: https://dozzle.dev/guide/what-is-dozzle/hostname These examples demonstrate how to change Dozzle's displayed hostname. This can be achieved by passing the `--hostname` flag directly to the `docker run` command or by setting the `DOZZLE_HOSTNAME` environment variable within a `docker-compose.yml` service definition. ```sh docker run --volume=/var/run/docker.sock:/var/run/docker.sock -p 8080:8080 amir20/dozzle --hostname mywebsite.xyz ``` ```yaml services: dozzle: image: amir20/dozzle:latest volumes: - /var/run/docker.sock:/var/run/docker.sock ports: - 8080:8080 environment: DOZZLE_HOSTNAME: mywebsite.xyz ``` -------------------------------- ### Changing Dozzle Agent Hostname Source: https://dozzle.dev/guide/what-is-dozzle/agent This section demonstrates how to change the Dozzle agent's display name, which will be reflected in the UI. It provides examples using both a direct 'docker run' command and a 'docker-compose.yml' configuration with an environment variable. ```Shell docker run -v /var/run/docker.sock:/var/run/docker.sock -p 7007:7007 amir20/dozzle:latest agent --hostname my-special-name ``` ```YAML services: dozzle-agent: image: amir20/dozzle:latest command: agent environment: - DOZZLE_HOSTNAME=my-special-name volumes: - /var/run/docker.sock:/var/run/docker.sock:ro ports: - 7007:7007 ``` -------------------------------- ### Configure Dozzle to Connect to Remote Docker Hosts with TLS Source: https://dozzle.dev/guide/what-is-dozzle/remote-hosts Dozzle can connect to remote Docker hosts using TLS. This configuration requires mounting certificates to the /certs directory within the container. Multiple hosts can be specified either via repeated CLI flags or a comma-separated environment variable. ```sh $ docker run -v /var/run/docker.sock:/var/run/docker.sock -v /path/to/certs:/certs -p 8080:8080 amir20/dozzle --remote-host tcp://167.99.1.1:2376 --remote-host tcp://167.99.1.2:2376 ``` ```yaml services: dozzle: image: amir20/dozzle:latest volumes: - /var/run/docker.sock:/var/run/docker.sock - /path/to/certs:/certs ports: - 8080:8080 environment: DOZZLE_REMOTE_HOST: tcp://167.99.1.1:2376,tcp://167.99.1.2:2376 ``` -------------------------------- ### Kubernetes Deployment for Dozzle with Single Namespace Restriction Source: https://dozzle.dev/guide/what-is-dozzle/k8s This YAML configuration defines a Kubernetes Deployment for Dozzle. It demonstrates how to restrict Dozzle's log monitoring to a specific namespace, 'default' in this example, by setting the `DOZZLE_NAMESPACE` environment variable within the container specification. This is useful for limiting Dozzle's scope in multi-tenant clusters. ```yaml apiVersion: apps/v1 kind: Deployment metadata: name: dozzle spec: selector: matchLabels: app: dozzle template: metadata: labels: app: dozzle spec: serviceAccountName: pod-viewer containers: - name: dozzle image: amir20/dozzle:latest ports: - containerPort: 8080 env: - name: DOZZLE_MODE value: "k8s" - name: DOZZLE_NAMESPACE value: "default" ``` -------------------------------- ### Override Container Name with Docker Label Source: https://dozzle.dev/guide/what-is-dozzle/container-names Demonstrates how to set a custom display name for a Docker container in Dozzle using the `dev.dozzle.name` label. This is useful when direct container name modification is not possible. Examples are provided for both Docker CLI and Docker Compose configurations. ```sh docker run --label dev.dozzle.name=hello hello-world ``` ```yaml services: dozzle: image: hello-world labels: - dev.dozzle.name=hello ``` -------------------------------- ### Implementing Custom Certificates for Dozzle Agent Communication Source: https://dozzle.dev/guide/what-is-dozzle/agent This section details how to provide custom SSL/TLS certificates for the Dozzle agent, enhancing security beyond the default self-signed certificates. It includes examples for mounting certificates via Docker secrets in 'docker-compose.yml' and commands to generate new certificates using OpenSSL. ```YAML services: agent: image: amir20/dozzle:latest command: agent volumes: - /var/run/docker.sock:/var/run/docker.sock secrets: - source: cert target: /dozzle_cert.pem - source: key target: /dozzle_key.pem ports: - 7007:7007 secrets: cert: file: ./cert.pem key: file: ./key.pem ``` ```Shell $ openssl genpkey -algorithm Ed25519 -out key.pem $ openssl req -new -key key.pem -out request.csr -subj "/C=US/ST=California/L=San Francisco/O=My Company" $ openssl x509 -req -in request.csr -signkey key.pem -out cert.pem -days 365 ``` -------------------------------- ### Configure Nginx Proxy for Dozzle with Custom Base Source: https://dozzle.dev/guide/what-is-dozzle/changing-base Provides an Nginx server block configuration to proxy Dozzle when it's running with a custom base path. This setup ensures correct routing and asset loading for Dozzle behind a reverse proxy, mapping `/foobar/` to the Dozzle application. ```nginx location ^~ /foobar/ { set $upstream_app dozzle; set $upstream_port 8080; set $upstream_proto http; proxy_pass $upstream_proto://$upstream_app:$upstream_port; chunked_transfer_encoding off; proxy_buffering off; proxy_cache off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } ``` -------------------------------- ### Connect Dozzle UI to Remote Agent Source: https://dozzle.dev/guide/what-is-dozzle/agent Examples demonstrating how to connect a Dozzle UI instance to a remote Dozzle agent. The UI connects to the agent's IP address and port (e.g., 7007) and does not require local Docker socket access, as it retrieves container information from the agent. ```sh docker run -p 8080:8080 amir20/dozzle:latest --remote-agent agent-ip:7007 ``` ```yaml services: dozzle: image: amir20/dozzle:latest environment: - DOZZLE_REMOTE_AGENT=agent:7007 ports: - 8080:8080 # Dozzle UI port ``` -------------------------------- ### Configure Dozzle Healthcheck in Docker Compose Source: https://dozzle.dev/guide/what-is-dozzle/healthcheck This YAML configuration defines a Docker Compose service for Dozzle, including volume and port mappings, and specifically sets up an internal healthcheck. The healthcheck command `dozzle healthcheck` is executed every 3 seconds, with a 30-second timeout, 5 retries, and a 30-second start period, ensuring the Dozzle container's health is continuously monitored. ```yaml services: dozzle: image: amir20/dozzle:latest volumes: - /var/run/docker.sock:/var/run/docker.sock ports: - 8080:8080 healthcheck: test: ["CMD", "/dozzle", "healthcheck"] interval: 3s timeout: 30s retries: 5 start_period: 30s ``` -------------------------------- ### Authelia Server Configuration File Source: https://dozzle.dev/guide/what-is-dozzle/authentication This YAML configuration file specifies core settings for an Authelia server instance. It includes parameters for JWT secret, server host and port, logging level, and defines a file-based authentication backend. Crucially, it sets access control rules for specific domains like `traefik.example.com` and `dozzle.example.com`, enforcing one-factor authentication through Authelia. ```yaml jwt_secret: a_very_important_secret default_redirection_url: https://public.example.com server: host: 0.0.0.0 port: 9091 log: level: info totp: issuer: authelia.com authentication_backend: file: path: /config/users_database.yml access_control: default_policy: deny rules: - domain: traefik.example.com policy: one_factor - domain: dozzle.example.com policy: one_factor session: secret: unsecure_session_secret domain: example.com # Should match whatever your root protected domain is regulation: max_retries: 3 find_time: 120 ban_time: 300 storage: encryption_key: you_must_generate_a_random_string_of_more_than_twenty_chars_and_configure_this local: path: /config/db.sqlite3 notifier: filesystem: filename: /config/notification.txt ``` -------------------------------- ### Run Dozzle with file-based authentication using Docker CLI Source: https://dozzle.dev/guide/what-is-dozzle/authentication This command demonstrates how to run Dozzle via the Docker CLI, mounting the Docker socket and a data directory (`/data`) where the `users.yml` file is expected. It enables simple authentication using the `--auth-provider simple` flag. ```sh $ docker run -v /var/run/docker.sock:/var/run/docker.sock -v /path/to/dozzle/data:/data -p 8080:8080 amir20/dozzle --auth-provider simple ``` -------------------------------- ### Generate Dozzle users.yml File Source: https://dozzle.dev/guide/what-is-dozzle/authentication Utilize Dozzle's built-in 'generate' command to create a 'users.yml' file. This command allows specifying a username, password, optional email, name, and user-specific filters. The output can be redirected to create the 'users.yml' file directly. ```sh docker run -it --rm amir20/dozzle generate admin --password password --email test@email.net --name "John Doe" --user-filter name=foo > users.yml ``` -------------------------------- ### Verify Kubernetes Metrics API Server Status Source: https://dozzle.dev/guide/what-is-dozzle/k8s This command verifies that the Kubernetes Metrics API server is running and accessible by attempting to list resource usage for pods. A successful output indicates the Metrics API is functioning correctly. ```bash kubectl top pod ``` -------------------------------- ### Configure Dozzle with file-based authentication using Docker Compose Source: https://dozzle.dev/guide/what-is-dozzle/authentication This Docker Compose snippet shows how to set up Dozzle with file-based authentication. It defines a service that mounts the Docker socket and a data volume for user management, and sets the `DOZZLE_AUTH_PROVIDER` environment variable to `simple`. ```yaml services: dozzle: image: amir20/dozzle:latest volumes: - /var/run/docker.sock:/var/run/docker.sock - /path/to/dozzle/data:/data ports: - 8080:8080 environment: DOZZLE_AUTH_PROVIDER: simple ``` -------------------------------- ### Dozzle `generate` Command Options Source: https://dozzle.dev/guide/what-is-dozzle/supported-env-vars Describes the command-line flags available for the `dozzle generate` command, used to create user entries for the `users.yml` authentication file. ```APIDOC Flag: --password Description: User's password Default: "" Flag: --email Description: User's email Default: "" Flag: --name Description: User's full name Default: "" ``` -------------------------------- ### Initial SQL Engine Table Creation Query Source: https://dozzle.dev/guide/what-is-dozzle/sql-engine This SQL query is automatically executed by Dozzle when the SQL Engine is initialized. It creates a virtual table named `logs` by unnesting the JSON log data from `logs.json`, making individual log entries accessible for SQL queries. ```sql CREATE TABLE logs AS SELECT unnest(m) FROM 'logs.json' ``` -------------------------------- ### Verify Docker Memory Limit Support on ARM Devices Source: https://dozzle.dev/guide/what-is-dozzle/faq This output from `docker info` indicates a lack of memory limit support on ARM devices, which prevents Dozzle from displaying container memory consumption. The warnings `No memory limit support` and `No swap limit support` confirm this underlying Docker API limitation. ```shell WARNING: No memory limit support WARNING: No swap limit support ``` -------------------------------- ### Configure Dozzle for Forward Proxy Authentication Source: https://dozzle.dev/guide/what-is-dozzle/authentication Set up Dozzle to authenticate users via a forward proxy by configuring '--auth-provider' to 'forward-proxy'. In this mode, Dozzle expects specific HTTP headers from the proxy to identify the user and their attributes. These headers include user, email, name, and filter information. ```sh $ docker run -v /var/run/docker.sock:/var/run/docker.sock -p 8080:8080 amir20/dozzle --auth-provider forward-proxy ``` ```yaml services: dozzle: image: amir20/dozzle:latest volumes: - /var/run/docker.sock:/var/run/docker.sock ports: - 8080:8080 environment: DOZZLE_AUTH_PROVIDER: forward-proxy ``` ```APIDOC Expected Headers: * Remote-User: Maps to the username (e.g., johndoe) * Remote-Email: Maps to the user's email address (used for Gravatar) * Remote-Name: Display name (e.g., John Doe) * Remote-Filter: Comma-separated list of filters allowed for the user ``` -------------------------------- ### Create Dozzle Agent Source: https://dozzle.dev/guide/what-is-dozzle/agent Instructions for setting up a Dozzle agent, which exposes a Docker host to other Dozzle instances. This agent listens on port 7007 and requires access to the Docker socket to monitor containers. ```sh docker run -v /var/run/docker.sock:/var/run/docker.sock -p 7007:7007 amir20/dozzle:latest agent ``` ```yaml services: dozzle-agent: image: amir20/dozzle:latest command: agent volumes: - /var/run/docker.sock:/var/run/docker.sock:ro ports: - 7007:7007 ``` -------------------------------- ### Generate Dozzle users.yml for Authentication Source: https://dozzle.dev/guide/what-is-dozzle/supported-env-vars Provides a Docker command to generate a `users.yml` file for Dozzle authentication. This file contains user credentials, including optional email and name for avatar display. ```sh docker run -it --rm amir20/dozzle generate admin --password password --email test@email.net --name "John Doe" > users.yml ``` -------------------------------- ### Configure Dozzle Container Actions in Docker Compose Source: https://dozzle.dev/guide/what-is-dozzle/actions This `docker-compose.yml` snippet defines a Dozzle service that integrates with the Docker daemon via volume mounting. It enables the container actions feature by setting the `DOZZLE_ENABLE_ACTIONS` environment variable to `true`, providing persistent configuration for managing containers through Dozzle. ```yaml services: dozzle: image: amir20/dozzle:latest volumes: - /var/run/docker.sock:/var/run/docker.sock ports: - 8080:8080 environment: DOZZLE_ENABLE_ACTIONS: true ``` -------------------------------- ### Dozzle Kubernetes Deployment and RBAC Configuration Source: https://dozzle.dev/guide/what-is-dozzle/k8s This comprehensive YAML configuration defines the necessary Kubernetes resources to deploy Dozzle, including a ServiceAccount, ClusterRole, ClusterRoleBinding for RBAC permissions, a Deployment for the Dozzle application, and a Service to expose it. It grants Dozzle permissions to view pods, logs, and nodes, and sets the DOZZLE_MODE environment variable to 'k8s'. ```yaml # rbac.yaml apiVersion: v1 kind: ServiceAccount metadata: name: pod-viewer --- # clusterrole.yaml apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: pod-viewer-role rules: - apiGroups: [""] resources: ["pods", "pods/log", "nodes"] verbs: ["get", "list", "watch"] - apiGroups: ["metrics.k8s.io"] resources: ["pods"] verbs: ["get", "list"] --- # clusterrolebinding.yaml apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: pod-viewer-binding subjects: - kind: ServiceAccount name: pod-viewer namespace: default roleRef: kind: ClusterRole name: pod-viewer-role apiGroup: rbac.authorization.k8s.io --- # deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: dozzle spec: selector: matchLabels: app: dozzle template: metadata: labels: app: dozzle spec: serviceAccountName: pod-viewer containers: - name: dozzle image: amir20/dozzle:latest ports: - containerPort: 8080 env: - name: DOZZLE_MODE value: "k8s" --- # service.yaml apiVersion: v1 kind: Service metadata: name: dozzle-service spec: type: ClusterIP selector: app: dozzle ports: - port: 8080 targetPort: 8080 protocol: TCP ``` -------------------------------- ### Configure Dozzle with file-based authentication using Docker secrets Source: https://dozzle.dev/guide/what-is-dozzle/authentication This Docker Compose configuration demonstrates how to manage `users.yml` securely using Docker secrets. It defines a Dozzle service that consumes a secret named 'users' and mounts it to `/data/users.yml`, enabling file-based authentication. ```yaml services: dozzle: image: amir20/dozzle:latest environment: - DOZZLE_AUTH_PROVIDER=simple secrets: - source: users target: /data/users.yml volumes: - /var/run/docker.sock:/var/run/docker.sock - dozzle:/data secrets: users: file: users.yml volumes: dozzle: ``` -------------------------------- ### Dozzle Agent Mode Configuration Options Source: https://dozzle.dev/guide/what-is-dozzle/supported-env-vars Details the configuration options specific to Dozzle's agent mode, including the address for the agent. ```APIDOC Flag: --addr Env Variable: DOZZLE_AGENT_ADDR Default: :7007 ``` -------------------------------- ### Configure User-Specific Container Filters in Dozzle Source: https://dozzle.dev/guide/what-is-dozzle/authentication Define specific container filters for individual users within the 'users.yml' file. This allows restricting which containers a user can view. Users without a filter can see all containers, while those with a filter are limited to containers matching the specified criteria, such as a label. ```yaml users: admin: email: name: Admin password: $2a$11$9ho4vY2LdJ/WBopFcsAS0uORC0x2vuFHQgT/yBqZyzclhHsoaIkzK filter: guest: email: name: Guest password: $2a$11$9ho4vY2LdJ/WBopFcsAS0uORC0x2vuFHQgT/yBqZyzclhHsoaIkzK filter: "label=com.example.app" ``` -------------------------------- ### Add Kernel Parameters for Memory Cgroup on ARM Source: https://dozzle.dev/guide/what-is-dozzle/faq This line should be added to `/boot/cmdline.txt` on ARM devices to enable cgroup memory support. Rebooting the device after this modification allows the Docker API to correctly report memory usage, enabling Dozzle to display memory consumption. ```text cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1 ``` -------------------------------- ### Automate Dozzle engine-id creation using Ansible Source: https://dozzle.dev/guide/what-is-dozzle/podman Ansible playbook tasks to programmatically create the `/var/lib/docker` directory and populate the `engine-id` file with a UUID derived from the hostname. This provides an automated solution for ensuring Dozzle compatibility with Podman deployments. ```YAML - name: Create /var/lib/docker ansible.builtin.file: path: /var/lib/docker state: directory mode: "755" - name: Create engine-id and derive UUID from hostname ansible.builtin.lineinfile: path: /var/lib/docker/engine-id line: "{{ hostname | to_uuid }}" create: true mode: "0644" insertafter: "EOF" ``` -------------------------------- ### Generate Dozzle engine-id with uuidgen for Podman Source: https://dozzle.dev/guide/what-is-dozzle/podman Detailed steps to manually create the `/var/lib/docker/engine-id` file using the `uuidgen` command-line tool. This is a common fix for 'host not found' errors when running Dozzle with Podman, as Podman does not automatically generate this ID like Docker. ```Shell mkdir -p /var/lib/docker uuidgen > /var/lib/docker/engine-id cat /var/lib/docker/engine-id ``` -------------------------------- ### Kubernetes Deployment for Dozzle with Label-Based Filtering Source: https://dozzle.dev/guide/what-is-dozzle/k8s This YAML configuration outlines a Kubernetes Deployment for Dozzle, showcasing how to apply label-based filtering to the logs it monitors. By setting the `DOZZLE_FILTER` environment variable to 'env=prod', Dozzle will only display logs from pods matching this label. This provides fine-grained control over which logs are visible. ```yaml apiVersion: apps/v1 kind: Deployment metadata: name: dozzle spec: selector: matchLabels: app: dozzle template: metadata: labels: app: dozzle spec: serviceAccountName: pod-viewer containers: - name: dozzle image: amir20/dozzle:latest ports: - containerPort: 8080 env: - name: DOZZLE_MODE value: "k8s" - name: DOZZLE_FILTER value: "env=prod" ``` -------------------------------- ### Run Dozzle in Agent Mode Source: https://dozzle.dev/guide/what-is-dozzle/supported-env-vars Demonstrates how to run Dozzle in agent mode using Docker, allowing it to monitor a different Docker host. This mode is enabled via the `--remote-agent` flag. ```sh docker run --volume=/var/run/docker.sock:/var/run/docker.sock -p 8080:8080 amir20/dozzle --remote-agent remote-ip:7007 ``` -------------------------------- ### Dozzle Docker Compose Configuration with Cloudflare Zero Trust Authentication Source: https://dozzle.dev/guide/what-is-dozzle/authentication This YAML configuration defines a Docker Compose service for Dozzle. It sets up Dozzle to use `forward-proxy` authentication, expecting user email from the `Cf-Access-Authenticated-User-Email` header, which is typically provided by Cloudflare Access. It also mounts the Docker socket, exposes port 8080, and ensures the container restarts unless stopped. ```yaml services: dozzle: image: amir20/dozzle:latest networks: - net environment: DOZZLE_AUTH_PROVIDER: forward-proxy DOZZLE_AUTH_HEADER_USER: Cf-Access-Authenticated-User-Email DOZZLE_AUTH_HEADER_EMAIL: Cf-Access-Authenticated-User-Email DOZZLE_AUTH_HEADER_NAME: Cf-Access-Authenticated-User-Email volumes: - /var/run/docker.sock:/var/run/docker.sock expose: - 8080 restart: unless-stopped ``` -------------------------------- ### Change Dozzle Base Path with Docker Run Source: https://dozzle.dev/guide/what-is-dozzle/changing-base Demonstrates how to change Dozzle's base path using the `--base` flag with a `docker run` command. This makes Dozzle accessible at a custom URL prefix, such as `/foobar/`. ```sh docker run --volume=/var/run/docker.sock:/var/run/docker.sock -p 8080:8080 amir20/dozzle --base /foobar ``` -------------------------------- ### Dozzle Global Environment Variables Configuration Source: https://dozzle.dev/guide/what-is-dozzle/supported-env-vars Comprehensive list of command-line flags and their corresponding environment variables for configuring Dozzle, including default values. These variables control various aspects of Dozzle's operation. ```APIDOC Flag: --addr Env Variable: DOZZLE_ADDR Default: :8080 Flag: --base Env Variable: DOZZLE_BASE Default: / Flag: --hostname Env Variable: DOZZLE_HOSTNAME Default: "" Flag: --level Env Variable: DOZZLE_LEVEL Default: info Flag: --auth-provider Env Variable: DOZZLE_AUTH_PROVIDER Default: none Flag: --auth-header-user Env Variable: DOZZLE_AUTH_HEADER_USER Default: Remote-User Flag: --auth-header-email Env Variable: DOZZLE_AUTH_HEADER_EMAIL Default: Remote-Email Flag: --auth-header-name Env Variable: DOZZLE_AUTH_HEADER_NAME Default: Remote-Name Flag: --enable-actions Env Variable: DOZZLE_ENABLE_ACTIONS Default: false Flag: --enable-shell Env Variable: DOZZLE_ENABLE_SHELL Default: false Flag: --filter Env Variable: DOZZLE_FILTER Default: "" Flag: --no-analytics Env Variable: DOZZLE_NO_ANALYTICS Default: false Flag: --mode Env Variable: DOZZLE_MODE Default: server Flag: --remote-host Env Variable: DOZZLE_REMOTE_HOST Default: "" Flag: --remote-agent Env Variable: DOZZLE_REMOTE_AGENT Default: "" Flag: --timeout Env Variable: DOZZLE_TIMEOUT Default: 10s Flag: --namespace Env Variable: DOZZLE_NAMESPACE Default: "" ``` -------------------------------- ### Enable Shell Access for Dozzle Containers Source: https://dozzle.dev/guide/what-is-dozzle/shell Dozzle's shell access feature allows direct command execution within containers from the web interface. This functionality is disabled by default due to security implications and can be enabled using either a direct `docker run` command or a `docker-compose.yml` configuration. ```sh docker run --volume=/var/run/docker.sock:/var/run/docker.sock -p 8080:8080 amir20/dozzle --enable-shell ``` ```yaml services: dozzle: image: amir20/dozzle:latest volumes: - /var/run/docker.sock:/var/run/docker.sock ports: - 8080:8080 environment: DOZZLE_ENABLE_SHELL: true ``` -------------------------------- ### Deploy Dozzle in Docker Swarm Mode using Docker Stack Source: https://dozzle.dev/guide/what-is-dozzle/swarm-mode This Docker Stack configuration deploys Dozzle across all nodes in a Docker Swarm cluster using `mode: global`. It sets the `DOZZLE_MODE` environment variable to `swarm` to enable Swarm-specific features and creates an `overlay` network for inter-Dozzle communication. It requires mounting the Docker socket for container discovery. ```YAML services: dozzle: image: amir20/dozzle:latest environment: - DOZZLE_MODE=swarm volumes: - /var/run/docker.sock:/var/run/docker.sock ports: - 8080:8080 networks: - dozzle deploy: mode: global networks: dozzle: driver: overlay ``` -------------------------------- ### Docker Compose Configuration for Dozzle with Remote Agent in Swarm Mode Source: https://dozzle.dev/guide/what-is-dozzle/swarm-mode This Docker Compose configuration defines a Dozzle service for deployment in Swarm Mode. It specifies the Dozzle image, sets environment variables to enable Swarm mode and connect to a remote agent (agent:7007), mounts the Docker socket, exposes port 8080, and configures a global deployment mode with an overlay network named 'dozzle'. ```yml services: dozzle: image: amir20/dozzle:latest environment: - DOZZLE_MODE=swarm - DOZZLE_REMOTE_AGENT=agent:7007 volumes: - /var/run/docker.sock:/var/run/docker.sock ports: - 8080:8080 networks: - dozzle deploy: mode: global networks: dozzle: driver: overlay ``` -------------------------------- ### Configuring Dozzle Agent Filters for Docker Containers Source: https://dozzle.dev/guide/what-is-dozzle/agent This section explains how to apply filters to the Dozzle agent, limiting which containers it can access and display. These filters are passed directly to Docker, allowing for fine-grained control over visibility. ```YAML services: dozzle-agent: image: amir20/dozzle:latest command: agent environment: - DOZZLE_FILTER=label=color volumes: - /var/run/docker.sock:/var/run/docker.sock:ro ``` -------------------------------- ### Configure Nginx to Disable Buffering for Dozzle SSE Source: https://dozzle.dev/guide/what-is-dozzle/faq This Nginx configuration demonstrates how to disable `proxy_buffering` and `proxy_cache` for Dozzle's API endpoint. This is essential to ensure Server-Sent Events (SSE) work correctly, preventing logs from being slow or failing to load due to proxy buffering. ```nginx server { ... location / { proxy_pass http://:8080; } location /api { proxy_pass http://:8080; proxy_buffering off; proxy_cache off; } } ``` -------------------------------- ### Change Dozzle Base Path with Docker Compose Source: https://dozzle.dev/guide/what-is-dozzle/changing-base Illustrates how to configure Dozzle's base path using the `DOZZLE_BASE` environment variable within a `docker-compose.yml` file. This sets the application's root URL when deployed with Docker Compose. ```yaml services: dozzle: image: amir20/dozzle:latest volumes: - /var/run/docker.sock:/var/run/docker.sock ports: - 8080:8080 environment: DOZZLE_BASE: /foobar ``` -------------------------------- ### Configure Simple Authentication for Dozzle in Docker Swarm with Secrets Source: https://dozzle.dev/guide/what-is-dozzle/swarm-mode This Docker Stack configuration extends the global Dozzle deployment to include simple authentication using Docker secrets. It sets `DOZZLE_AUTH_PROVIDER` to `simple` and mounts a Docker secret named `users` (sourced from `users.yml`) to `/data/users.yml` inside the container, allowing user credentials to be securely managed. ```YAML services: dozzle: image: amir20/dozzle:latest environment: - DOZZLE_LEVEL=debug - DOZZLE_MODE=swarm - DOZZLE_AUTH_PROVIDER=simple volumes: - /var/run/docker.sock:/var/run/docker.sock secrets: - source: users target: /data/users.yml ports: - "8080:8080" networks: - dozzle deploy: mode: global networks: dozzle: driver: overlay secrets: users: file: users.yml ```