Skip to content

Commit

Permalink
fix issue #1 - when using Colima docker-compose ps output is different
Browse files Browse the repository at this point in the history
than if running Docker on Linux or using Docker Desktop on Mac
  • Loading branch information
Ava Czechowska committed Feb 13, 2022
1 parent 926d16f commit 7ec26ee
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docker_compose_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ func (dc DockerComposeDriver) getDCContainersNames(mergedConfig Config, projectN
cmdInfo := cmdInfoToString(cmd, stdout, stderr, exitStatus)
if strings.Contains(stderr, "No such container") {
// Workaround for issue #27: do not panic but print error level log message.
dc.Logger.Log("error", fmt.Sprintf("Unexpected exit status:\n#{cmdInfo}"))
dc.Logger.Log("error", fmt.Sprintf("Unexpected exit status:\n%s", cmdInfo))
return []string{}
} else {
panic(fmt.Errorf("Unexpected exit status:\n%s", cmdInfo))
Expand All @@ -625,8 +625,10 @@ func (dc DockerComposeDriver) getDCContainersNames(mergedConfig Config, projectN
panic(fmt.Errorf("Unexpected empty stdout: %s", cmdInfo))
}
lines := strings.Split(stdout,"\n")
if strings.Contains(lines[len(lines)-1], "-----") {
// the last line of output is the one with -----
if len(lines) < 2 || strings.Contains(lines[len(lines)-1], "-----") {
// if running on Linux or using Docker Desktop,
// the last line of output is the one with -----;
// if using Colima, there is just 1 line of output
dc.Logger.Log("debug", "Containers were not yet created")
return []string{}
}
Expand Down

0 comments on commit 7ec26ee

Please sign in to comment.