| 150 | } |
| 151 | |
| 152 | func checkDocker(ctx context.Context) error { |
| 153 | out, err := newCmd(ctx, "docker", "info", "--format", "json").Output() |
| 154 | if err != nil { |
| 155 | return fmt.Errorf("error executing the 'docker info' command: %w", err) |
| 156 | } |
| 157 | |
| 158 | info := make(map[string]any) |
| 159 | err = json.Unmarshal(out, &info) |
| 160 | if err != nil { |
| 161 | return fmt.Errorf("error parsing the output of 'docker info': %w", err) |
| 162 | } |
| 163 | |
| 164 | if sv, ok := info["ServerVersion"].(string); !ok || sv == "" { |
| 165 | return errors.New("error extracting the Docker server version (is Docker running?)") |
| 166 | } |
| 167 | |
| 168 | if se, ok := info["ServerErrors"].([]string); ok && len(se) > 0 { |
| 169 | return fmt.Errorf("docker not available: found errors: %v", se) |
| 170 | } |
| 171 | |
| 172 | return nil |
| 173 | } |
| 174 | |
| 175 | func checkRillRepo() error { |
| 176 | _, err := os.Stat(".git") |