mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
Docker Swarm stack support
Signed-off-by: Dowideit, Sven (O&A, St. Lucia) <Sven.Dowideit@csiro.au>
This commit is contained in:
parent
b8d477f4e5
commit
3f593b75dc
2 changed files with 15 additions and 10 deletions
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
@ -91,14 +90,9 @@ func NewDockerCommand(log *logrus.Entry, osCommand *OSCommand, tr *i18n.Translat
|
||||||
|
|
||||||
log.Warn(command)
|
log.Warn(command)
|
||||||
|
|
||||||
err = osCommand.RunCommand(
|
err = osCommand.RunCommand(command)
|
||||||
utils.ApplyTemplate(
|
|
||||||
config.UserConfig.CommandTemplates.CheckDockerComposeConfig,
|
|
||||||
dockerCommand.NewCommandObject(CommandObject{}),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
dockerCommand.InDockerComposeProject = false
|
//dockerCommand.InDockerComposeProject = false
|
||||||
log.Warn(err.Error())
|
log.Warn(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -251,6 +245,11 @@ L:
|
||||||
service.Container = container
|
service.Container = container
|
||||||
continue L
|
continue L
|
||||||
}
|
}
|
||||||
|
if container.Container.Labels["com.docker.swarm.service.name"] == service.Name {
|
||||||
|
//Swarm service
|
||||||
|
service.Container = container
|
||||||
|
continue L
|
||||||
|
}
|
||||||
}
|
}
|
||||||
service.Container = nil
|
service.Container = nil
|
||||||
}
|
}
|
||||||
|
|
@ -348,8 +347,8 @@ func (c *DockerCommand) GetServices() ([]*Service, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
composeCommand := c.Config.UserConfig.CommandTemplates.DockerCompose
|
composeConfigHash := c.Config.UserConfig.CommandTemplates.DockerComposeConfigHash
|
||||||
output, err := c.OSCommand.RunCommandWithOutput(fmt.Sprintf("%s config --hash=*", composeCommand))
|
output, err := c.OSCommand.RunCommandWithOutput(composeConfigHash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,11 @@ type CommandTemplatesConfig struct {
|
||||||
// file(s)
|
// file(s)
|
||||||
DockerComposeConfig string `yaml:"dockerComposeConfig,omitempty"`
|
DockerComposeConfig string `yaml:"dockerComposeConfig,omitempty"`
|
||||||
|
|
||||||
|
// Print the service config hash, one per line.
|
||||||
|
// Set "service1,service2" for a list of specified services
|
||||||
|
// or use the wildcard symbol to display all services
|
||||||
|
DockerComposeConfigHash string `yaml:"dockerComposeConfigHash,omitempty"`
|
||||||
|
|
||||||
// CheckDockerComposeConfig is what we use to check whether we are in a
|
// CheckDockerComposeConfig is what we use to check whether we are in a
|
||||||
// docker-compose context. If the command returns an error then we clearly
|
// docker-compose context. If the command returns an error then we clearly
|
||||||
// aren't in a docker-compose config and we then just hide the services panel
|
// aren't in a docker-compose config and we then just hide the services panel
|
||||||
|
|
@ -335,6 +340,7 @@ func GetDefaultConfig() UserConfig {
|
||||||
AllLogs: "{{ .DockerCompose }} logs --tail=300 --follow",
|
AllLogs: "{{ .DockerCompose }} logs --tail=300 --follow",
|
||||||
ViewAllLogs: "{{ .DockerCompose }} logs",
|
ViewAllLogs: "{{ .DockerCompose }} logs",
|
||||||
DockerComposeConfig: "{{ .DockerCompose }} config",
|
DockerComposeConfig: "{{ .DockerCompose }} config",
|
||||||
|
DockerComposeConfigHash: "{{ .DockerCompose }} config --hash=*",
|
||||||
CheckDockerComposeConfig: "{{ .DockerCompose }} config --quiet",
|
CheckDockerComposeConfig: "{{ .DockerCompose }} config --quiet",
|
||||||
ContainerLogs: "docker logs --timestamps --follow --since=60m {{ .Container.ID }}",
|
ContainerLogs: "docker logs --timestamps --follow --since=60m {{ .Container.ID }}",
|
||||||
ViewContainerLogs: "docker logs --timestamps --follow --since=60m {{ .Container.ID }}",
|
ViewContainerLogs: "docker logs --timestamps --follow --since=60m {{ .Container.ID }}",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue