Create a network

Create custom networks for your containers by using the podman network create command. You can configure external access or create isolated internal networks for secure container communication.

Before you begin

  • The container-tools meta-package is installed.

About this task

By default, Podman creates an external network. You can create an internal network in which containers can communicate with other containers on the host, but cannot connect to networks outside the host.

Procedure

Create the external network named mynet:
# podman network create mynet
/etc/cni/net.d/mynet.conflist

Results

  • List all networks:
    # podman network ls
    NETWORK ID    NAME        VERSION     PLUGINS
    2f259bab93aa  podman      0.4.0       bridge,portmap,firewall,tuning
    11c844f95e28  mynet       0.4.0       bridge,portmap,firewall,tuning,dnsname

    You can see the created mynet network and default podman network.

Note

Beginning with Podman 4.0, the DNS plugin is enabled by default if you create a new external network by using the podman network create command.

Refer to podman-network-create(1) man page on your system for more information.