MCPcopy Create free account
hub / github.com/containerd/nerdctl / writeCIDFile

Function writeCIDFile

pkg/cmd/container/create.go:1028–1045  ·  view source on GitHub ↗
(path, id string)

Source from the content-addressed store, hash-verified

1026}
1027
1028func writeCIDFile(path, id string) error {
1029 _, err := os.Stat(path)
1030 if err == nil {
1031 return fmt.Errorf("container ID file found, make sure the other container isn't running or delete %s", path)
1032 } else if errors.Is(err, os.ErrNotExist) {
1033 f, err := os.Create(path)
1034 if err != nil {
1035 return fmt.Errorf("failed to create the container ID file: %s for %s, err: %s", path, id, err)
1036 }
1037 defer f.Close()
1038
1039 if _, err := f.WriteString(id); err != nil {
1040 return err
1041 }
1042 return nil
1043 }
1044 return err
1045}
1046
1047// generateLogConfig creates a LogConfig for the current container store
1048func generateLogConfig(dataStore string, id string, logDriver string, logOpt []string, ns, address string) (logConfig logging.LogConfig, err error) {

Callers 1

CreateFunction · 0.85

Calls 3

StatMethod · 0.80
CreateMethod · 0.65
CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…