github.com/containers/podman/v5@v5.1.0-rc1/docs/source/markdown/options/network.image.md (about) 1 ####> This option file is used in: 2 ####> podman build, farm build 3 ####> If file is edited, make sure the changes 4 ####> are applicable to all of those. 5 #### **--network**=*mode*, **--net** 6 7 Sets the configuration for network namespaces when handling `RUN` instructions. 8 9 Valid _mode_ values are: 10 11 - **none**: no networking. 12 - **host**: use the Podman host network stack. Note: the host mode gives the 13 container full access to local system services such as D-bus and is therefore 14 considered insecure. 15 - **ns:**_path_: path to a network namespace to join. 16 - **private**: create a new namespace for the container (default) 17 - **\<network name|ID\>**: Join the network with the given name or ID, e.g. use `--network mynet` to join the network with the name mynet. Only supported for rootful users. 18 - **slirp4netns[:OPTIONS,...]**: use **slirp4netns**(1) to create a user network stack. This is the default for rootless containers. It is possible to specify these additional options, they can also be set with `network_cmd_options` in containers.conf: 19 - **allow_host_loopback=true|false**: Allow slirp4netns to reach the host loopback IP (default is 10.0.2.2 or the second IP from slirp4netns cidr subnet when changed, see the cidr option below). The default is false. 20 - **mtu=MTU**: Specify the MTU to use for this network. (Default is `65520`). 21 - **cidr=CIDR**: Specify ip range to use for this network. (Default is `10.0.2.0/24`). 22 - **enable_ipv6=true|false**: Enable IPv6. Default is true. (Required for `outbound_addr6`). 23 - **outbound_addr=INTERFACE**: Specify the outbound interface slirp binds to (ipv4 traffic only). 24 - **outbound_addr=IPv4**: Specify the outbound ipv4 address slirp binds to. 25 - **outbound_addr6=INTERFACE**: Specify the outbound interface slirp binds to (ipv6 traffic only). 26 - **outbound_addr6=IPv6**: Specify the outbound ipv6 address slirp binds to. 27 - **pasta[:OPTIONS,...]**: use **pasta**(1) to create a user-mode networking 28 stack. \ 29 This is only supported in rootless mode. \ 30 By default, IPv4 and IPv6 addresses and routes, as well as the pod interface 31 name, are copied from the host. If port forwarding isn't configured, ports 32 are forwarded dynamically as services are bound on either side (init 33 namespace or container namespace). Port forwarding preserves the original 34 source IP address. Options described in pasta(1) can be specified as 35 comma-separated arguments. \ 36 In terms of pasta(1) options, **--config-net** is given by default, in 37 order to configure networking when the container is started, and 38 **--no-map-gw** is also assumed by default, to avoid direct access from 39 container to host using the gateway address. The latter can be overridden 40 by passing **--map-gw** in the pasta-specific options (despite not being an 41 actual pasta(1) option). \ 42 Also, **-t none** and **-u none** are passed to disable 43 automatic port forwarding based on bound ports. Similarly, **-T none** and 44 **-U none** are given to disable the same functionality from container to 45 host. \ 46 Some examples: 47 - **pasta:--map-gw**: Allow the container to directly reach the host using the 48 gateway address. 49 - **pasta:--mtu,1500**: Specify a 1500 bytes MTU for the _tap_ interface in 50 the container. 51 - **pasta:--ipv4-only,-a,10.0.2.0,-n,24,-g,10.0.2.2,--dns-forward,10.0.2.3,-m,1500,--no-ndp,--no-dhcpv6,--no-dhcp**, 52 equivalent to default slirp4netns(1) options: disable IPv6, assign 53 `10.0.2.0/24` to the `tap0` interface in the container, with gateway 54 `10.0.2.3`, enable DNS forwarder reachable at `10.0.2.3`, set MTU to 1500 55 bytes, disable NDP, DHCPv6 and DHCP support. 56 - **pasta:-I,tap0,--ipv4-only,-a,10.0.2.0,-n,24,-g,10.0.2.2,--dns-forward,10.0.2.3,--no-ndp,--no-dhcpv6,--no-dhcp**, 57 equivalent to default slirp4netns(1) options with Podman overrides: same as 58 above, but leave the MTU to 65520 bytes 59 - **pasta:-t,auto,-u,auto,-T,auto,-U,auto**: enable automatic port forwarding 60 based on observed bound ports from both host and container sides 61 - **pasta:-T,5201**: enable forwarding of TCP port 5201 from container to 62 host, using the loopback interface instead of the tap interface for improved 63 performance