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

podman network prune is missing #8673

Closed
rhatdan opened this issue Dec 9, 2020 · 6 comments
Closed

podman network prune is missing #8673

rhatdan opened this issue Dec 9, 2020 · 6 comments
Assignees
Labels
In Progress This issue is actively being worked by the assignee, please do not work on this at this time. kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@rhatdan
Copy link
Member

rhatdan commented Dec 9, 2020

Docker has a network prune, so podman should as well.

Once network prune is added, it should also be wired into podman system prune.

@rhatdan rhatdan added Good First Issue This issue would be a good issue for a first time contributor to undertake. kind/bug Categorizes issue or PR as related to a bug. labels Dec 9, 2020
@Luap99
Copy link
Member

Luap99 commented Dec 9, 2020

Podman does not store any network information inside the db. podman network create creates a cni config file in /etc/cni/net.d/ so the idea would be to remove all config files which are currently not used by any container.

Users can add their own cni configs directly to this directory and don't have to use podman network create. What should a network prune do in this case? Should it remove files not created by podman and how would we know if the file was created by podman?

@rhatdan
Copy link
Member Author

rhatdan commented Dec 9, 2020

Good point. Theoretically it would look through all of it's containers and see if any use the network, and then if not remove the networks that were created. We could also do something with labels to indicate that podman created the file. And only remove files created with podman. Didn't you do something similar?

Bottom line is it is probably to dangerous, and maybe we should just document in podman network why there is no prune command and explain to users how to remove unused networks.

@Luap99
Copy link
Member

Luap99 commented Dec 9, 2020

For future networks we could definitely add some key/label to the the config file to indicate that we are allowed to remove this file.
I agree that it is dangerous to blindly remove files. There could be other applications who rely on files in there.

I added a TODO comment for a dangling filter for network ls. Maybe its better to implement this and document that that the user should use ls --filter dangling=true. With that they can make sure that nothing important is in there.

@github-actions
Copy link

github-actions bot commented Jan 9, 2021

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member Author

rhatdan commented Jan 10, 2021

@Luap99 @baude Interested in working on this, or at least adding documentation on not supported to man page. Before 3.0?

@baude baude self-assigned this Feb 3, 2021
@baude baude added In Progress This issue is actively being worked by the assignee, please do not work on this at this time. and removed Good First Issue This issue would be a good issue for a first time contributor to undertake. labels Feb 3, 2021
baude added a commit to baude/podman that referenced this issue Feb 6, 2021
add the ability to prune unused cni networks.  filters are not implemented
but included both compat and podman api endpoints.

Fixes :containers#8673

Signed-off-by: baude <[email protected]>
@baude
Copy link
Member

baude commented Feb 8, 2021

network prune is merged.

sstosh added a commit to sstosh/podman that referenced this issue Jun 14, 2022
This is an enhancement for the podman system prune feature.

In this issue, it is mentioned that 'network prune' should be
wired into 'podman system prune'
containers#8673

Therefore, I add the function to remove unused networks.

Signed-off-by: Toshiki Sonoda <[email protected]>
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
In Progress This issue is actively being worked by the assignee, please do not work on this at this time. kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

3 participants