1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-21 21:33:18 +01:00

feat: implements support for custom container names (#3197)

This commit is contained in:
Jérémy Touati
2024-08-13 17:04:51 +02:00
committed by GitHub
parent 6c5dcb7a62
commit acbb2a8d24
3 changed files with 37 additions and 2 deletions

View File

@@ -356,7 +356,9 @@ func (d *httpClient) SystemInfo() system.Info {
func newContainer(c types.Container, host string) Container {
name := "no name"
if len(c.Names) > 0 {
if c.Labels["dev.dozzle.name"] != "" {
name = c.Labels["dev.dozzle.name"]
} else if len(c.Names) > 0 {
name = strings.TrimPrefix(c.Names[0], "/")
}
@@ -380,7 +382,9 @@ func newContainer(c types.Container, host string) Container {
func newContainerFromJSON(c types.ContainerJSON, host string) Container {
name := "no name"
if len(c.Name) > 0 {
if c.Config.Labels["dev.dozzle.name"] != "" {
name = c.Config.Labels["dev.dozzle.name"]
} else if len(c.Name) > 0 {
name = strings.TrimPrefix(c.Name, "/")
}