connect
docker.network.connect(network, container, alias=None, driver_options=[], ip=None, ip6=None, links=[])
Connect a container to a network
Arguments
- network
Union[python_on_whales.Network, str]
: The network to connect to - container
Union[python_on_whales.Container, str]
: The container to connect - alias
Optional[str]
: Add network-scoped alias for the container - driver_options
List[str]
: Driver options for the network - ip
Optional[str]
: IPv4 address (e.g.,"172.30.100.104"
) - ip6
Optional[str]
: IPv6 address (e.g.,"2001:db8::33"
) - links
List[Union[python_on_whales.Container, str]]
: Add links to other containers
create
docker.network.create(name, attachable=False, driver=None, gateway=None, subnet=None, labels={}, options=[])
Creates a Docker network.
Arguments
- name
str
: The name of the network
Returns
A python_on_whales.Network
.
disconnect
docker.network.disconnect(network, container, force=False)
Disconnect a container from a network
Arguments
- network
Union[python_on_whales.Network, str]
: The name of the network. - container
Union[python_on_whales.Container, str]
: The container to disconnect.
inspect
docker.network.inspect(x)
list
docker.network.list(filters={})
prune
docker.network.prune(filters={})
remove
docker.network.remove(networks)
Removes a Docker network
Arguments
- networks
Union[python_on_whales.Network, str, List[Union[python_on_whales.Network, str]]]
: One or more networks.