podman-network-prune(1)

πŸ’… podman-network-prune β€” bestie's guide to yeeting unused networks

Okay so real talk, this is the podman-network-prune manual page from the General Commands Manual, and it's literally just here to help you clean up. Let's get into it ✨


🌸 NAME 🌸

podman-network-prune β€” remove all unused networks (yes, all of them, bye πŸ‘‹)


πŸ¦‹ SYNOPSIS πŸ¦‹

podman network prune [options]

That's it, that's the whole thing. No positional args, no drama, just vibes and options πŸ’…


πŸ’– DESCRIPTION πŸ’–

So what this does is it removes all unused networks. And like, what even is an "unused network"? Glad you asked, bestie β€” the manpage defines it as a network which has no containers connected or configured to connect to it. Nobody's using it, nobody's planning to use it, it's giving ghost town energy πŸ‘»

One big ol' exception though: it does not remove the so-called default network, the one that goes by the name of podman. That one's the main character and it stays. periodt πŸ‘‘

✨ OPTIONS ✨

  • --filter β€” provide filter values. That's the whole idea. More on how below πŸŽ€
  • --force, -f β€” do not prompt for confirmation. Live fast, prune without asking, no cap πŸ’€

πŸ” the --filter situation (it's giving detail)

Okay so --filter needs a little more explaining, because there's rules.

If there's more than one filter, you gotta pass the --filter option multiple times, like this:

--filter label=test --filter until=10m

Supported filters, bestie:

  • label β€” only remove networks with (or without, in the case of label!=[...] being used) the specified labels.
  • until β€” only remove networks created before the given timestamp.

Now for the label filter, there are two formats you can use:

  1. label=key or label=key=value β€” this one removes networks with the specified labels.
  2. label!=key or label!=key=value β€” this one removes networks without the specified labels. Note the sneaky ! β€” it flips the whole thing πŸ™ˆ

And the until filter? It accepts:

  • Unix timestamps
  • date formatted timestamps
  • Go duration strings (e.g. 10m, 1h30m) β€” and these are computed relative to the machine's time ⏰

🌈 EXAMPLE 🌈

Prune networks:

podman network prune

Prune all networks created not created in the last two hours (yes, that's the original wording, and honestly? iconic):

podman network prune --filter until=2h

πŸ’œ SEE ALSO πŸ’œ

Go read those too, they're the friend group πŸ’«


πŸŽ€ HISTORY πŸŽ€

February 2021, originally compiled by Brent Baude bbaude@redhat.com ⟨mailto:bbaude@redhat.com⟩ β€” shoutout to Brent for writing this down so the rest of us could thrive 🫢


that's the whole page, bestie β€” this was podman-network-prune(1) from the General Commands Manual, source/version and date and all, and you ate it up πŸ’…βœ¨

πŸ“¦ where this page comes from