-
| DescriptionThe error occurs when I quickly and repeatedly create and delete containers, this error is occasional. In most cases, the error is: Steps to reproduce the issuefunc RunCmdAndWait(name string, args ...string) (string, error) {
	cmd := exec.Command(name, args...)
	stdout, _ := cmd.StdoutPipe()
	stderr, _ := cmd.StderrPipe()
	if err = cmd.Start(); err != nil {
		return "", err
	}
	errB, err := io.ReadAll(stderr)
	if err != nil {
		return "", err
	}
	resp, err := io.ReadAll(stdout)
	if err != nil {
		return "", err
	}
	if err := cmd.Wait(); err != nil {
		if len(errB) > 0 {
			return "", errors.New(string(errB))
		}
		return "", err
	}
	return string(resp), nil
}
func main() {
	for i := 0; i < 50; i++ {
		RunCmdAndWait("nerdctl", "rm", "-f", "redis")
		_, err := RunCmdAndWait("nerdctl", "run", "-d", "--name", "redis", "--restart", "always", "redis")
		if err != nil {
			fmt.Println(err)
			break
		}
	}
}
...
time="2023-04-19T17:04:09+08:00" level=fatal msg="name \"redis\" is already used by ID \"93eee71cf69efc9494436192869015820890ebfe4db6ef8712d9fb9f63f33ce1\""Using the command method has the same problem shell: Describe the results you received and expectedExpect no errors. What version of nerdctl are you using?🔥 nerdctl version
Client:
 Version:	1.3.1
 OS/Arch:	linux/amd64
 Git commit:	<unknown>
 buildctl:
  Version:	0.11.5
  GitCommit:	alpine
Server:
 containerd:
  Version:	v1.7.0
  GitCommit:	1fbd70374134b891f97ce19c70b6e50c7b9f4e0d
 runc:
  Version:	1.1.6
  GitCommit:	0f48801a0e21e3f0bc4e74643ead2a502df4818dAre you using a variant of nerdctl? (e.g., Rancher Desktop)None Host information🔥 nerdctl info                                                                                                                                         Client:
 Namespace:	default
 Debug Mode:	false
Server:
 Server Version: v1.7.0
 Storage Driver: overlayfs
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Log: fluentd journald json-file syslog
  Storage: native overlayfs
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 6.1.23-4-lts
 Operating System: Alpine Linux edge
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 15.41GiB
 Name: x
 ID: dd8788c1-a4a7-4fd2-8768-a7422ba8bb08
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled | 
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
| Looks like a concurrency problem. But I can not reproduce it on my local host. cc @containerd/nerdctl-maintainers And just wondering do you have the same problem replacing  | 
Beta Was this translation helpful? Give feedback.
Looks like a concurrency problem. But I can not reproduce it on my local host. cc @containerd/nerdctl-maintainers
And just wondering do you have the same problem replacing
nerdctlwithdocker?