Description
While investigating #2992, I noticed that AllocHostsFile is called before we verify that the requested --name for the container to be started is actually available.
If the name is not free, we bail out, but we leave the allocated host file in place.
Steps to reproduce the issue
# Just repeatedly run containers with the exact same name
sudo ./nerdctl-patch run -d --name whatevername debian bash
sudo ./nerdctl-patch run -d --name whatevername debian bash
sudo ./nerdctl-patch run -d --name whatevername debian bash
Describe the results you received and expected
Now, /var/lib/nerdctl/XXXX/etchosts/default will start filling up with orphaned files.
This is also true for /var/lib/nerdctl/1935db59/containers/default.
Looking at create.go shows why.
What version of nerdctl are you using?
1.7.6
Are you using a variant of nerdctl? (e.g., Rancher Desktop)
None
Host information
No response
Description
While investigating #2992, I noticed that
AllocHostsFileis called before we verify that the requested--namefor the container to be started is actually available.If the name is not free, we bail out, but we leave the allocated host file in place.
Steps to reproduce the issue
Describe the results you received and expected
Now, /var/lib/nerdctl/XXXX/etchosts/default will start filling up with orphaned files.
This is also true for
/var/lib/nerdctl/1935db59/containers/default.Looking at
create.goshows why.What version of nerdctl are you using?
1.7.6
Are you using a variant of nerdctl? (e.g., Rancher Desktop)
None
Host information
No response