pub struct NetworkCreateOptions {
pub name: String,
pub check_duplicate: bool,
pub driver: String,
pub internal: bool,
pub attachable: bool,
pub ingress: bool,
pub ipam: IPAM,
pub enable_ipv6: bool,
pub options: HashMap<String, String>,
pub labels: HashMap<String, String>,
}Expand description
request body of /networks/create api
Fields§
§name: String§check_duplicate: bool§driver: String§internal: boolRestrict connections between containers to only those under the same network.
Default false
attachable: bool§ingress: bool§ipam: IPAM§enable_ipv6: bool§options: HashMap<String, String>§labels: HashMap<String, String>Implementations§
Source§impl NetworkCreateOptions
Create network options
impl NetworkCreateOptions
Create network options
To create a network equivalent to the default bridge network, set the options as follows:
let network_name = "sample-network";
let mut opt = NetworkCreateOptions::new(network_name);
opt.enable_icc()
.enable_ip_masquerade()
.host_binding_ipv4(Ipv4Addr::new(0, 0, 0, 0))
.bridge_name("docker0")
.driver_mtu(1500);
// let network = docker.create_network(&opt)?;Sourcepub fn bridge_name(&mut self, name: &str) -> &mut Self
pub fn bridge_name(&mut self, name: &str) -> &mut Self
bridge name to be used when creating the Linux bridge
Sourcepub fn enable_ip_masquerade(&mut self) -> &mut Self
pub fn enable_ip_masquerade(&mut self) -> &mut Self
equivalent to --ip-masq of dockerd flag
Sourcepub fn enable_icc(&mut self) -> &mut Self
pub fn enable_icc(&mut self) -> &mut Self
equivalent to --icc of dockerd flag
Sourcepub fn host_binding_ipv4(&mut self, ipv4: Ipv4Addr) -> &mut Self
pub fn host_binding_ipv4(&mut self, ipv4: Ipv4Addr) -> &mut Self
equivalent to --ip of dockerd flag
Sourcepub fn driver_mtu(&mut self, mtu: u16) -> &mut Self
pub fn driver_mtu(&mut self, mtu: u16) -> &mut Self
equivalent to --mtu option
pub fn label(&mut self, key: &str, value: &str) -> &mut Self
Trait Implementations§
Source§impl Clone for NetworkCreateOptions
impl Clone for NetworkCreateOptions
Source§fn clone(&self) -> NetworkCreateOptions
fn clone(&self) -> NetworkCreateOptions
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NetworkCreateOptions
impl Debug for NetworkCreateOptions
Source§impl<'de> Deserialize<'de> for NetworkCreateOptions
impl<'de> Deserialize<'de> for NetworkCreateOptions
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for NetworkCreateOptions
impl PartialEq for NetworkCreateOptions
Source§impl Serialize for NetworkCreateOptions
impl Serialize for NetworkCreateOptions
impl Eq for NetworkCreateOptions
impl StructuralPartialEq for NetworkCreateOptions
Auto Trait Implementations§
impl Freeze for NetworkCreateOptions
impl RefUnwindSafe for NetworkCreateOptions
impl Send for NetworkCreateOptions
impl Sync for NetworkCreateOptions
impl Unpin for NetworkCreateOptions
impl UnwindSafe for NetworkCreateOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more