PodmanResource manager subclassed for Network resources.

Classes and methods for manipulating network resources via Podman API service.


with PodmanClient(base_url=”unix:///run/user/1000/podman/podman.sock”) as client:
for net in client.networks.list():

print(, “


class NetworksManager(client: APIClient = None)[source]

Bases: Manager

Specialized Manager for Network resources.

Initialize Manager() object.


client – APIClient() configured to connect to Podman service.

create(name: str, **kwargs) Network[source]

Create a Network resource.


name – Name of network to be created

Keyword Arguments:
  • attachable (bool) – Ignored, always False.

  • check_duplicate (bool) – Ignored, always False.

  • dns_enabled (bool) – When True, do not provision DNS for this network.

  • driver (str) – Which network driver to use when creating network.

  • enable_ipv6 (bool) – Enable IPv6 on the network.

  • ingress (bool) – Ignored, always False.

  • internal (bool) – Restrict external access to the network.

  • ipam (IPAMConfig) – Optional custom IP scheme for the network.

  • labels (Dict[str, str]) – Map of labels to set on the network.

  • options (Dict[str, Any]) – Driver options.

  • scope (str) – Ignored, always “local”.


APIError – when Podman service reports an error

exists(key: str) bool[source]

Returns True if resource exists.

Podman only.


This method does _not_ provide any mutex mechanism.

get(key: str) Network[source]

Return information for the network_id.


key – Network name or id.

  • NotFound – when Network does not exist

  • APIError – when error returned by service

list(**kwargs) List[Network][source]

Report on networks.

Keyword Arguments:
  • names (List[str]) – List of names to filter by.

  • ids (List[str]) – List of identifiers to filter by.

  • filters (Mapping[str,str]) –

    Criteria for listing networks. Available filters:

    • driver=”bridge”: Matches a network’s driver. Only “bridge” is supported.

    • label=(Union[str, List[str]]): format either “key”, “key=value” or a list of such.

    • type=(str): Filters networks by type, legal values are:

      • ”custom”

      • ”builtin”

    • plugin=(List[str]]): Matches CNI plugins included in a network, legal values are (Podman only):

      • bridge

      • portmap

      • firewall

      • tuning

      • dnsname

      • macvlan

  • greedy (bool) – Fetch more details for each network individually. You might want this to get the containers attached to them. Ignored.


APIError – when error returned by service

prepare_model(attrs: PodmanResource | Mapping[str, Any]) PodmanResourceType

Create a model from a set of attributes.

prune(filters: Dict[str, Any] | None = None) Dict[Literal['NetworksDeleted', 'SpaceReclaimed'], Any][source]

Delete unused Networks.

SpaceReclaimed always reported as 0


filters – Criteria for selecting volumes to delete. Ignored.


APIError – when service reports error

remove(name: [<class 'podman.domain.networks.Network'>, <class 'str'>], force: bool | None = None) None[source]

Remove Network resource.

  • name – Identifier of Network to delete.

  • force – Remove network and any associated containers


APIError – when Podman service reports an error

property resource

prepare_model() will create Network classes.