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"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"sort"
|
||||
"strings"
|
||||
|
|
@ -91,14 +90,9 @@ func NewDockerCommand(log *logrus.Entry, osCommand *OSCommand, tr *i18n.Translat
|
|||
|
||||
log.Warn(command)
|
||||
|
||||
err = osCommand.RunCommand(
|
||||
utils.ApplyTemplate(
|
||||
config.UserConfig.CommandTemplates.CheckDockerComposeConfig,
|
||||
dockerCommand.NewCommandObject(CommandObject{}),
|
||||
),
|
||||
)
|
||||
err = osCommand.RunCommand(command)
|
||||
if err != nil {
|
||||
dockerCommand.InDockerComposeProject = false
|
||||
//dockerCommand.InDockerComposeProject = false
|
||||
log.Warn(err.Error())
|
||||
}
|
||||
|
||||
|
|
@ -251,6 +245,11 @@ L:
|
|||
service.Container = container
|
||||
continue L
|
||||
}
|
||||
if container.Container.Labels["com.docker.swarm.service.name"] == service.Name {
|
||||
//Swarm service
|
||||
service.Container = container
|
||||
continue L
|
||||
}
|
||||
}
|
||||
service.Container = nil
|
||||
}
|
||||
|
|
@ -348,8 +347,8 @@ func (c *DockerCommand) GetServices() ([]*Service, error) {
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
composeCommand := c.Config.UserConfig.CommandTemplates.DockerCompose
|
||||
output, err := c.OSCommand.RunCommandWithOutput(fmt.Sprintf("%s config --hash=*", composeCommand))
|
||||
composeConfigHash := c.Config.UserConfig.CommandTemplates.DockerComposeConfigHash
|
||||
output, err := c.OSCommand.RunCommandWithOutput(composeConfigHash)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,6 +175,11 @@ type CommandTemplatesConfig struct {
|
|||
// file(s)
|
||||
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
|
||||
// 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
|
||||
|
|
@ -335,6 +340,7 @@ func GetDefaultConfig() UserConfig {
|
|||
AllLogs: "{{ .DockerCompose }} logs --tail=300 --follow",
|
||||
ViewAllLogs: "{{ .DockerCompose }} logs",
|
||||
DockerComposeConfig: "{{ .DockerCompose }} config",
|
||||
DockerComposeConfigHash: "{{ .DockerCompose }} config --hash=*",
|
||||
CheckDockerComposeConfig: "{{ .DockerCompose }} config --quiet",
|
||||
ContainerLogs: "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