Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions cli/azd/pkg/tools/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,21 +247,26 @@ func isSupportedDockerVersion(cliOutput string) (bool, error) {
return false, fmt.Errorf("could not determine version from docker version string: %s", version)
}
func (d *Cli) CheckInstalled(ctx context.Context) error {
toolName := d.Name()
err := tools.ToolInPath("docker")
if err != nil {
return err
}
dockerRes, err := tools.ExecuteCommand(ctx, d.commandRunner, "docker", "--version")
if err != nil {
return fmt.Errorf("checking %s version: %w", d.Name(), err)
return fmt.Errorf("checking %s version: %w", toolName, err)
}
log.Printf("docker version: %s", dockerRes)
supported, err := isSupportedDockerVersion(dockerRes)
if err != nil {
return err
}
if !supported {
return &tools.ErrSemver{ToolName: d.Name(), VersionInfo: d.versionInfo()}
return &tools.ErrSemver{ToolName: toolName, VersionInfo: d.versionInfo()}
}
// Check if docker daemon is running
if _, err := tools.ExecuteCommand(ctx, d.commandRunner, "docker", "ps"); err != nil {
return fmt.Errorf("the %s daemon is not running, please start the %s service: %w", toolName, toolName, err)
}
return nil
}
Expand Down