MCPcopy Index your code
hub / github.com/rilldata/rill / checkDocker

Function checkDocker

cli/cmd/devtool/start.go:152–173  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

150}
151
152func 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
175func checkRillRepo() error {
176 _, err := os.Stat(".git")

Callers 1

startFunction · 0.85

Calls 2

newCmdFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected