MCPcopy
hub / github.com/tuna/tunasync / postExec

Method postExec

worker/docker.go:68–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

66}
67
68func (d *dockerHook) postExec() error {
69 // sh.Command(
70 // "docker", "rm", "-f", d.Name(),
71 // ).Run()
72 name := d.Name()
73 retry := 10
74 for ; retry > 0; retry-- {
75 out, err := sh.Command(
76 "docker", "ps", "-a",
77 "--filter", "name=^"+name+"$",
78 "--format", "{{.Status}}",
79 ).Output()
80 if err != nil {
81 logger.Errorf("docker ps failed: %v", err)
82 break
83 }
84 if len(out) == 0 {
85 break
86 }
87 logger.Debugf("container %s still exists: '%s'", name, string(out))
88 time.Sleep(1 * time.Second)
89 }
90 if retry == 0 {
91 logger.Warningf("container %s not removed automatically, next sync may fail", name)
92 }
93 d.provider.ExitContext()
94 return nil
95}
96
97// Volumes returns the configured volumes and
98// runtime-needed volumes, including mirror dirs

Callers 1

TestDockerFunction · 0.95

Calls 5

NameMethod · 0.95
ErrorfMethod · 0.80
DebugfMethod · 0.80
WarningfMethod · 0.80
ExitContextMethod · 0.65

Tested by 1

TestDockerFunction · 0.76