Set the network mode

Specify the network configuration for a container by using the podman run command with the --network option during startup. You can select modes such as host networking or attach to a custom bridge.

Before you begin

  • The container-tools module is installed.

Procedure

  1. Optional: If you want to use the pasta network mode, install the passt package:
    $ dnf install passt
  2. Run the container-based on the registry.access.redhat.com/ubi10/ubi image:
    $ podman run --network=<network_mode>  -d --name=myubi registry.access.redhat.com/ubi10/ubi

    The <network_mode> is the required network mode. Alternatively, you can use the default_rootless_network_cmd option in the containers.conf file to switch the default network mode.

    Note

    The default network mode for rootless containers is pasta.

Results

  • Verify the setting of the network mode:
    $ podman inspect --format {{.HostConfig.NetworkMode}} myubi
    <network_mode>