Skip to content

A self-hosted dashboard that puts all your feeds in one place

Merge branch 'dev' into Add-support-configure-docker-containers-yaml

Svilen Markov306c28f20311
diff --cc docs/configuration.md
index 1f2ad89,497da94..cb7b835
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@@ -1791,17 -1885,67 +1898,71 @@@ If any of the child containers are down
| Name | Type | Required | Default |
| ---- | ---- | -------- | ------- |
| hide-by-default | boolean | no | false |
+| format-container-names | boolean | no | false |
| sock-path | string | no | /var/run/docker.sock |
+ | category | string | no | |
+ | running-only | boolean | no | false |
##### `hide-by-default`
Whether to hide the containers by default. If set to `true` you'll have to manually add a `glance.hide: false` label to each container you want to display. By default all containers will be shown and if you want to hide a specific container you can add a `glance.hide: true` label.
+##### `format-container-names`
+When set to `true`, automatically converts container names such as `container_name_1` into `Container Name 1`.
+
##### `sock-path`
- The path to the Docker socket.
+ The path to the Docker socket. This can also be a [remote socket](https://docs.docker.com/engine/daemon/remote-access/) or proxied socket using something like [docker-socket-proxy](https://github.com/Tecnativa/docker-socket-proxy).
+
+ ###### `category`
+ Filter to only the containers which have this category specified via the `glance.category` label. Useful if you want to have multiple containers widgets, each showing a different set of containers.
+
+ <details>
+ <summary>View example</summary>
+ <br>
+
+
+ ```yaml
+ services:
+ jellyfin:
+ image: jellyfin/jellyfin:latest
+ labels:
+ glance.name: Jellyfin
+ glance.icon: si:jellyfin
+ glance.url: https://jellyfin.domain.com
+ glance.category: media
+
+ gitea:
+ image: gitea/gitea:latest
+ labels:
+ glance.name: Gitea
+ glance.icon: si:gitea
+ glance.url: https://gitea.domain.com
+ glance.category: dev-tools
+
+ vaultwarden:
+ image: vaultwarden/server:latest
+ labels:
+ glance.name: Vaultwarden
+ glance.icon: si:vaultwarden
+ glance.url: https://vaultwarden.domain.com
+ glance.category: dev-tools
+ ```
+
+ Then you can use the `category` property to filter the containers:
+
+ ```yaml
+ - type: docker-containers
+ title: Dev tool containers
+ category: dev-tools
+
+ - type: docker-containers
+ title: Media containers
+ category: media
+ ```
+
+ </details>
+
+ ##### `running-only`
+ Whether to only show running containers. If set to `true` only containers that are currently running will be displayed. If set to `false` all containers will be displayed regardless of their state.
#### Labels
| Name | Description |
diff --cc internal/glance/templates/docker-containers.html
index 991d66d,d84e9a6..afbbb17
--- a/internal/glance/templates/docker-containers.html
+++ b/internal/glance/templates/docker-containers.html
@@@ -22,11 -22,11 +22,11 @@@
</div>
</div>
- <div class="min-width-0">
+ <div class="min-width-0 grow">
{{- if .URL }}
- <a href="{{ .URL | safeURL }}" class="color-highlight size-title-dynamic block text-truncate" {{ if not .SameTab }}target="_blank"{{ end }} rel="noreferrer">{{ .Title }}</a>
+ <a href="{{ .URL | safeURL }}" class="color-highlight size-title-dynamic block text-truncate" {{ if not .SameTab }}target="_blank"{{ end }} rel="noreferrer">{{ .Name }}</a>
{{- else }}
- <div class="color-highlight text-truncate size-title-dynamic">{{ .Title }}</div>
+ <div class="color-highlight text-truncate size-title-dynamic">{{ .Name }}</div>
{{- end }}
{{- if .Description }}
<div class="text-truncate">{{ .Description }}</div>
diff --cc internal/glance/widget-docker-containers.go
index 61cb388,7676ca2..702a34b
--- a/internal/glance/widget-docker-containers.go
+++ b/internal/glance/widget-docker-containers.go
@@@ -278,12 -243,7 +278,13 @@@ func isDockerContainerHidden(container
return hideByDefault
}
-func fetchDockerContainersFromSource(source string, category string, runningOnly bool) ([]dockerContainerJsonResponse, error) {
++
+func fetchDockerContainersFromSource(
+ source string,
+ category string,
+ runningOnly bool,
+ labelOverrides map[string]map[string]string,
+) ([]dockerContainerJsonResponse, error) {
var hostname string
var client *http.Client
@@@ -311,7 -271,16 +312,8 @@@
}
}
- query := url.Values{}
- query.Set("all", ternary(runningOnly, "false", "true"))
-
- if category != "" {
- query.Set(
- "filters",
- fmt.Sprintf(`{"label": ["%s=%s"]}`, dockerContainerLabelCategory, category),
- )
- }
+
+ fetchAll := ternary(runningOnly, "false", "true")
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()