Merge pull request #407 from nakaakist/fix-service-id

Resolves https://github.com/jesseduffield/lazydocker/issues/402
pull/420/head
Jesse Duffield 1 year ago committed by GitHub
commit 17fcdb2b20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -244,22 +244,21 @@ func (c *DockerCommand) GetServices() ([]*Service, error) {
} }
composeCommand := c.Config.UserConfig.CommandTemplates.DockerCompose composeCommand := c.Config.UserConfig.CommandTemplates.DockerCompose
output, err := c.OSCommand.RunCommandWithOutput(fmt.Sprintf("%s config --hash=*", composeCommand)) output, err := c.OSCommand.RunCommandWithOutput(fmt.Sprintf("%s config --services", composeCommand))
if err != nil { if err != nil {
return nil, err return nil, err
} }
// output looks like: // output looks like:
// service1 998d6d286b0499e0ff23d66302e720991a2asdkf9c30d0542034f610daf8a971 // service1
// service2 asdld98asdklasd9bccd02438de0994f8e19cbe691feb3755336ec5ca2c55971 // service2
lines := utils.SplitLines(output) lines := utils.SplitLines(output)
services := make([]*Service, len(lines)) services := make([]*Service, len(lines))
for i, str := range lines { for i, str := range lines {
arr := strings.Split(str, " ")
services[i] = &Service{ services[i] = &Service{
Name: arr[0], Name: str,
ID: arr[1], ID: str,
OSCommand: c.OSCommand, OSCommand: c.OSCommand,
Log: c.Log, Log: c.Log,
DockerCommand: c, DockerCommand: c,

Loading…
Cancel
Save