Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nerdctl is leaking host files when a container fails to start #2993

Open
apostasie opened this issue May 12, 2024 · 1 comment
Open

nerdctl is leaking host files when a container fails to start #2993

apostasie opened this issue May 12, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@apostasie
Copy link
Contributor

apostasie commented May 12, 2024

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

@apostasie apostasie added the kind/unconfirmed-bug-claim Unconfirmed bug claim label May 12, 2024
@apostasie
Copy link
Contributor Author

Seems to me like the general issue here is that we just do not clean-up anything if the container fails to create.
Solving this is likely more involved than just shuffling things around.

@AkihiroSuda AkihiroSuda added bug Something isn't working and removed kind/unconfirmed-bug-claim Unconfirmed bug claim labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants