MCPcopy Create free account
hub / github.com/abiosoft/colima / Start

Method Start

environment/container/docker/docker.go:82–105  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

80}
81
82func (d dockerRuntime) Start(ctx context.Context) error {
83 a := d.Init(ctx)
84
85 a.Retry("", time.Second, 60, func(int) error {
86 return d.systemctl.Start("docker.service")
87 })
88
89 // service startup takes few seconds, retry for a minute before giving up.
90 a.Retry("", time.Second, 60, func(int) error {
91 return d.guest.RunQuiet("sudo", "docker", "info")
92 })
93
94 // ensure docker is accessible without root
95 // otherwise, restart to ensure user is added to docker group
96 a.Add(func() error {
97 if err := d.guest.RunQuiet("docker", "info"); err == nil {
98 return nil
99 }
100 ctx := context.WithValue(ctx, cli.CtxKeyQuiet, true)
101 return d.guest.Restart(ctx)
102 })
103
104 return a.Exec()
105}
106
107func (d dockerRuntime) Running(ctx context.Context) bool {
108 return d.systemctl.Active("docker.service")

Callers

nothing calls this directly

Calls 7

RetryMethod · 0.80
AddMethod · 0.80
ExecMethod · 0.80
InitMethod · 0.65
StartMethod · 0.65
RunQuietMethod · 0.65
RestartMethod · 0.65

Tested by

no test coverage detected