|
1 | 1 | # Doku |
2 | | -Doku is a simple, lightweight web-based application that allows you to monitor Docker disk usage in a user-friendly manner. |
3 | | -The Doku displays the amount of disk space used by the Docker daemon, splits by images, containers, volumes, and builder cache. |
4 | | -If you're lucky, you'll also see the sizes of log files :) |
5 | | - |
6 | | -Doku should work for most. It has been tested with dozen of hosts. |
7 | | -<div> |
8 | | - |
9 | | -[](https://github.com/amerkurev/doku/actions/workflows/ci.yml) |
10 | | -[](https://coveralls.io/github/amerkurev/doku?branch=master) |
11 | | -[](https://goreportcard.com/report/github.com/amerkurev/doku) |
12 | | -[](https://hub.docker.com/r/amerkurev/doku/tags) |
13 | | -[](https://hub.docker.com/r/amerkurev/doku) |
| 2 | + |
| 3 | +Doku is a lightweight web application that helps you monitor Docker disk usage through a clean, intuitive interface. |
| 4 | + |
| 5 | +<div markdown="1"> |
| 6 | + |
| 7 | +[](https://github.com/amerkurev/doku/actions/workflows/ci.yml) |
| 8 | +[](https://coveralls.io/github/amerkurev/doku?branch=master) |
| 9 | +[](https://hub.docker.com/r/amerkurev/doku) |
| 10 | +[](https://github.com/amerkurev/doku/blob/master/LICENSE) |
14 | 11 | </div> |
15 | 12 |
|
16 | | - |
| 13 | +## Quick Start |
| 14 | + |
| 15 | +For those eager to get started, here's the fastest way to run Doku: |
| 16 | + |
| 17 | +```bash |
| 18 | +docker run -d -v /var/run/docker.sock:/var/run/docker.sock:ro -v /:/hostroot:ro -p 9090:9090 amerkurev/doku |
| 19 | +``` |
| 20 | + |
| 21 | +Then open http://localhost:9090/ in your browser. That's it! |
| 22 | + |
| 23 | +This command runs Doku with default settings and read-only access to your Docker socket and filesystem. See the sections below for more detailed setup options. |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | +## Features |
| 28 | + |
| 29 | +Doku monitors disk space used by: |
| 30 | + |
| 31 | +- Images |
| 32 | +- Containers |
| 33 | +- Volumes |
| 34 | +- Builder cache |
| 35 | +- Overlay2 storage (typically the largest consumer of disk space) |
| 36 | +- Container logs |
| 37 | +- Bind mounts |
17 | 38 |
|
18 | 39 | ## Getting Doku |
19 | 40 |
|
20 | | -Doku is a very small Docker container (6 MB compressed). Pull the latest release from the index: |
| 41 | +Pull the latest release from the Docker Hub: |
21 | 42 |
|
22 | | - docker pull amerkurev/doku:latest |
| 43 | +```bash |
| 44 | +docker pull amerkurev/doku:latest |
| 45 | +``` |
23 | 46 |
|
24 | 47 | ## Using Doku |
25 | 48 |
|
26 | | -The simplest way to use Doku is to run the Docker container. Mount the Docker Unix socket with `-v` to `/var/run/docker.sock`. Also, you need to mount the top-level directory (`/`) on the host machine in `ro` mode. Otherwise, Doku will not be able to calculate the size of the logs and bind mounts. |
| 49 | +The simplest way to use Doku is to run the Docker container. You'll need to mount two key resources: |
| 50 | + |
| 51 | +1. The Docker Unix socket with `-v /var/run/docker.sock:/var/run/docker.sock:ro` |
| 52 | +2. The top-level directory (`/`) of the host machine with `-v /:/hostroot:ro` |
27 | 53 |
|
28 | | - docker run --name doku -d -v /var/run/docker.sock:/var/run/docker.sock:ro -v /:/hostroot:ro -p 9090:9090 amerkurev/doku |
| 54 | +The root directory mount is critical for Doku to calculate disk usage of logs, bind mounts, and especially Overlay2 storage. Without this mount, many key features of Doku will not function properly. |
29 | 55 |
|
30 | | -Use following configuration for docker compose: |
| 56 | +```bash |
| 57 | +docker run --name doku -d -v /var/run/docker.sock:/var/run/docker.sock:ro -v /:/hostroot:ro -p 9090:9090 amerkurev/doku |
| 58 | +``` |
| 59 | + |
| 60 | +Important: All host mounts are in read-only (ro) mode. This ensures Doku can only read data and cannot modify or delete any files on your host system. Doku is strictly a monitoring tool and never performs any cleanup or disk space reclamation actions on its own. |
| 61 | + |
| 62 | +For more advanced configurations, you can add SSL certificates, authentication, and environment variables: |
| 63 | + |
| 64 | +```bash |
| 65 | +docker run -d --name doku \ |
| 66 | + --env-file=.env \ |
| 67 | + -v /var/run/docker.sock:/var/run/docker.sock:ro \ |
| 68 | + -v /:/hostroot:ro \ |
| 69 | + -v $(PWD)/.htpasswd:/.htpasswd \ |
| 70 | + -v $(PWD)/.ssl/key.pem:/.ssl/key.pem \ |
| 71 | + -v $(PWD)/.ssl/cert.pem:/.ssl/cert.pem \ |
| 72 | + -p 9090:9090 \ |
| 73 | + amerkurev/doku |
| 74 | +``` |
| 75 | + |
| 76 | +The `--env-file=.env` option allows you to specify various configuration parameters through environment variables. See the "Configuration Options" section below for details on all available settings. |
| 77 | + |
| 78 | +Doku will be available at http://localhost:9090/. You can change `-p 9090:9090` to any port. For example, if you want to view Doku over port 8080 then you would do `-p 8080:9090`. |
| 79 | + |
| 80 | +## Configuration Options |
| 81 | + |
| 82 | +Doku can be configured using environment variables. You can set these either directly when running the container or through an environment file passed with `--env-file=.env`. |
| 83 | + |
| 84 | +| Environment Variable | Description | Default | |
| 85 | +|---------------------|-------------|---------| |
| 86 | +| HOST | Interface address to bind the server to | 0.0.0.0 | |
| 87 | +| PORT | Web interface port number | 9090 | |
| 88 | +| LOG_LEVEL | Logging detail level (debug, info, warning, error, critical) | info | |
| 89 | +| SI | Use SI units (base 1000) instead of binary units (base 1024) | true | |
| 90 | +| BASIC_HTPASSWD | Path to the htpasswd file for basic authentication | /.htpasswd | |
| 91 | +| SCAN_INTERVAL | How often to collect basic Docker usage data (in seconds) | 60 | |
| 92 | +| SCAN_LOGFILE_INTERVAL | How frequently to check container log sizes (in seconds) | 60 | |
| 93 | +| SCAN_BINDMOUNTS_INTERVAL | Time between bind mount scanning operations (in seconds) | 3600 | |
| 94 | +| SCAN_OVERLAY2_INTERVAL | How often to analyze Overlay2 storage (in seconds) | 86400 | |
| 95 | +| SCAN_INTENSITY | Performance impact level: "aggressive" (highest CPU usage), "normal" (balanced), or "light" (lowest impact) | normal | |
| 96 | +| SCAN_USE_DU | Use the faster system `du` command for disk calculations instead of slower built-in methods | true | |
| 97 | +| UVICORN_WORKERS | Number of web server worker processes | 1 | |
| 98 | +| DEBUG | Enable detailed debug output | false | |
| 99 | +| DOCKER_HOST | Connection string for the Docker daemon | unix:///var/run/docker.sock | |
| 100 | +| DOCKER_TLS_VERIFY | Enable TLS verification for Docker daemon connection | false | |
| 101 | +| DOCKER_CERT_PATH | Directory containing Docker TLS certificates | null | |
| 102 | +| DOCKER_VERSION | Docker API version to use | auto | |
| 103 | + |
| 104 | +### Example .env file |
| 105 | + |
| 106 | +Here's an example `.env` file with some commonly adjusted settings: |
| 107 | + |
| 108 | +```ini |
| 109 | +PORT=9090 |
| 110 | +LOG_LEVEL=info |
| 111 | +SI=true |
| 112 | +SCAN_INTERVAL=120 |
| 113 | +SCAN_INTENSITY=light |
| 114 | +DEBUG=false |
| 115 | +``` |
31 | 116 |
|
32 | | -```yaml |
33 | | -version: "3" |
34 | | -services: |
35 | | - doku: |
36 | | - image: amerkurev/doku:v0.0.16 |
37 | | - ports: |
38 | | - - 9090:9090 |
39 | | - volumes: |
40 | | - - /var/run/docker.sock:/var/run/docker.sock:ro |
41 | | - - /:/hostroot:ro |
| 117 | +To use an environment file with Docker, include it when running the container: |
| 118 | + |
| 119 | +```bash |
| 120 | +docker run -d --name doku --env-file=.env -v /var/run/docker.sock:/var/run/docker.sock:ro -v /:/hostroot:ro -p 9090:9090 amerkurev/doku |
42 | 121 | ``` |
43 | 122 |
|
44 | | -Doku will be available at [http://localhost:9090/](http://localhost:9090/). You can change `-p 9090:9090` to any port. For example, if you want to view Doku over port 8080 then you would do `-p 8080:9090`. |
| 123 | +This loads all the variables from your `.env` file and applies them to Doku's configuration. |
45 | 124 |
|
46 | | -## Basic auth |
| 125 | +## Basic Authentication |
47 | 126 |
|
48 | | -Doku supports basic auth for all requests. This functionality is disabled by default. |
| 127 | +Doku supports HTTP basic authentication to secure access to the web interface. Follow these steps to enable it: |
49 | 128 |
|
50 | | -In order to enable basic auth, user should set the typical htpasswd file with `--basic-htpasswd=<file location>` or `env BASIC_HTPASSWD=<file location>`. |
| 129 | +1. Create an htpasswd file with bcrypt-encrypted passwords: |
| 130 | +```bash |
| 131 | +htpasswd -cbB .htpasswd admin yourpassword |
| 132 | +``` |
51 | 133 |
|
52 | | -Doku expects htpasswd file to be crypted with `bcrypt` algorithm in the following format: |
| 134 | +Add additional users with: |
| 135 | +```bash |
| 136 | +htpasswd -bB .htpasswd another_user anotherpassword |
| 137 | +``` |
53 | 138 |
|
| 139 | +2. Mount the htpasswd file when running Doku: |
| 140 | +```bash |
| 141 | +docker run -d --name doku \ |
| 142 | + -v /var/run/docker.sock:/var/run/docker.sock:ro \ |
| 143 | + -v /:/hostroot:ro \ |
| 144 | + -v $(PWD)/.htpasswd:/.htpasswd \ |
| 145 | + -p 9090:9090 \ |
| 146 | + amerkurev/doku |
54 | 147 | ``` |
55 | | -username1:bcrypt(password1) |
56 | | -username2:bcrypt(password2) |
57 | | -... |
| 148 | + |
| 149 | +3. If you want to use a custom path for the htpasswd file, specify it with the `BASIC_HTPASSWD` environment variable: |
| 150 | +```bash |
| 151 | +docker run -d --name doku \ |
| 152 | + -v /var/run/docker.sock:/var/run/docker.sock:ro \ |
| 153 | + -v /:/hostroot:ro \ |
| 154 | + -v $(PWD)/custom/path/.htpasswd:/auth/.htpasswd \ |
| 155 | + -e BASIC_HTPASSWD=/auth/.htpasswd \ |
| 156 | + -p 9090:9090 \ |
| 157 | + amerkurev/doku |
58 | 158 | ``` |
59 | 159 |
|
60 | | -this can be generated with `htpasswd -nbB` command, i.e. `htpasswd -nbB test passwd` |
| 160 | +Authentication will be required for all requests to Doku once enabled. |
| 161 | + |
| 162 | +## Supported Architectures |
| 163 | + |
| 164 | +Doku container images are available for the following platforms: |
61 | 165 |
|
62 | | -## Supported architectures |
63 | 166 | - linux/amd64 |
64 | | -- linux/arm/v7 |
65 | 167 | - linux/arm64 |
66 | 168 |
|
67 | | -## Special thanks to |
68 | | - |
69 | | -The following great works inspired me: |
70 | | -- Gatus: https://github.com/TwiN/gatus |
71 | | -- Dozzle: https://github.com/amir20/dozzle |
72 | | -- Reproxy: https://github.com/umputun/reproxy |
| 169 | +The multi-arch images are automatically selected based on your host platform when pulling from Docker Hub. |
73 | 170 |
|
74 | 171 | ## License |
75 | 172 |
|
|
0 commit comments