podman_rest_client/v5/models/
container_network_config.rs

1use serde::{Deserialize, Serialize};
2#[derive(Default, Debug, Serialize, Deserialize)]
3/// ContainerNetworkConfig contains information on a container's network
4/// configuration.
5pub struct ContainerNetworkConfig {
6    /// Map of networks names or ids that the container should join.
7    /// You can request additional settings for each network, you can
8    /// set network aliases, static ips, static mac address  and the
9    /// network interface name for this container on the specific network.
10    /// If the map is empty and the bridge network mode is set the container
11    /// will be joined to the default network.
12    /// Optional.
13    #[serde(rename = "Networks")]
14    pub networks: Option<std::collections::HashMap<String, crate::v5::models::PerNetworkOptions>>,
15    /// BaseHostsFile is the path to a hosts file, the entries from this file
16    /// are added to the containers hosts file. As special value "image" is
17    /// allowed which uses the /etc/hosts file from within the image and "none"
18    /// which uses no base file at all. If it is empty we should default
19    /// to the base_hosts_file configuration in containers.conf.
20    /// Optional.
21    pub base_hosts_file: Option<String>,
22    /// CNINetworks is a list of CNI networks to join the container to.
23    /// If this list is empty, the default CNI network will be joined
24    /// instead. If at least one entry is present, we will not join the
25    /// default network (unless it is part of this list).
26    /// Only available if NetNS is set to bridge.
27    /// Optional.
28    /// Deprecated: as of podman 4.0 use "Networks" instead.
29    pub cni_networks: Option<Vec<String>>,
30    /// DNSOptions is a set of DNS options that will be used in the
31    /// container's resolv.conf, replacing the host's DNS options which are
32    /// used by default.
33    /// Conflicts with UseImageResolvConf.
34    /// Optional.
35    pub dns_option: Option<Vec<String>>,
36    /// DNSSearch is a set of DNS search domains that will be used in the
37    /// container's resolv.conf, replacing the host's DNS search domains
38    /// which are used by default.
39    /// Conflicts with UseImageResolvConf.
40    /// Optional.
41    pub dns_search: Option<Vec<String>>,
42    /// DNSServers is a set of DNS servers that will be used in the
43    /// container's resolv.conf, replacing the host's DNS Servers which are
44    /// used by default.
45    /// Conflicts with UseImageResolvConf.
46    /// Optional.
47    pub dns_server: Option<Vec<String>>,
48    /// Expose is a number of ports that will be forwarded to the container
49    /// if PublishExposedPorts is set.
50    /// Expose is a map of uint16 (port number) to a string representing
51    /// protocol i.e map[uint16]string. Allowed protocols are "tcp", "udp", and "sctp", or some
52    /// combination of the three separated by commas.
53    /// If protocol is set to "" we will assume TCP.
54    /// Only available if NetNS is set to Bridge or Slirp, and
55    /// PublishExposedPorts is set.
56    /// Optional.
57    pub expose: Option<()>,
58    /// HostAdd is a set of hosts which will be added to the container's
59    /// etc/hosts file.
60    /// Conflicts with UseImageHosts.
61    /// Optional.
62    pub hostadd: Option<Vec<String>>,
63    pub netns: Option<crate::v5::models::Namespace>,
64    /// NetworkOptions are additional options for each network
65    /// Optional.
66    pub network_options: Option<std::collections::HashMap<String, Vec<String>>>,
67    /// PortBindings is a set of ports to map into the container.
68    /// Only available if NetNS is set to bridge, slirp, or pasta.
69    /// Optional.
70    pub portmappings: Option<Vec<crate::v5::models::PortMapping>>,
71    /// PublishExposedPorts will publish ports specified in the image to
72    /// random unused ports (guaranteed to be above 1024) on the host.
73    /// This is based on ports set in Expose below, and any ports specified
74    /// by the Image (if one is given).
75    /// Only available if NetNS is set to Bridge or Slirp.
76    /// Optional.
77    pub publish_image_ports: Option<bool>,
78    /// UseImageHosts indicates that /etc/hosts should not be managed by
79    /// Podman, and instead sourced from the image.
80    /// Conflicts with HostAdd.
81    /// Optional.
82    pub use_image_hosts: Option<bool>,
83    /// UseImageResolvConf indicates that resolv.conf should not be managed
84    /// by Podman, but instead sourced from the image.
85    /// Conflicts with DNSServer, DNSSearch, DNSOption.
86    /// Optional.
87    pub use_image_resolve_conf: Option<bool>,
88}