class documentation

class Network(Model): (source)

View In Hierarchy

A Docker network.

Method connect Connect a container to this network.
Method disconnect Disconnect a container from this network.
Method remove Remove this network.
Property containers The containers that are connected to the network, as a list of :py:class:`~docker.models.containers.Container` objects.
Property name The name of the network.

Inherited from Model:

Method __eq__ Undocumented
Method __hash__ Undocumented
Method __init__ Undocumented
Method __repr__ Undocumented
Method reload Load this object from the server again and update ``attrs`` with the new data.
Class Variable id_attribute Undocumented
Instance Variable attrs Undocumented
Instance Variable client Undocumented
Instance Variable collection Undocumented
Property id The ID of the object.
Property short_id The ID of the object, truncated to 12 characters.
def connect(self, container, *args, **kwargs): (source)

Connect a container to this network. Args: container (str): Container to connect to this network, as either an ID, name, or :py:class:`~docker.models.containers.Container` object. aliases (:py:class:`list`): A list of aliases for this endpoint. Names in that list can be used within the network to reach the container. Defaults to ``None``. links (:py:class:`list`): A list of links for this endpoint. Containers declared in this list will be linkedto this container. Defaults to ``None``. ipv4_address (str): The IP address of this container on the network, using the IPv4 protocol. Defaults to ``None``. ipv6_address (str): The IP address of this container on the network, using the IPv6 protocol. Defaults to ``None``. link_local_ips (:py:class:`list`): A list of link-local (IPv4/IPv6) addresses. driver_opt (dict): A dictionary of options to provide to the network driver. Defaults to ``None``. Raises: :py:class:`docker.errors.APIError` If the server returns an error.

def disconnect(self, container, *args, **kwargs): (source)

Disconnect a container from this network. Args: container (str): Container to disconnect from this network, as either an ID, name, or :py:class:`~docker.models.containers.Container` object. force (bool): Force the container to disconnect from a network. Default: ``False`` Raises: :py:class:`docker.errors.APIError` If the server returns an error.

def remove(self): (source)

Remove this network. Raises: :py:class:`docker.errors.APIError` If the server returns an error.

The containers that are connected to the network, as a list of :py:class:`~docker.models.containers.Container` objects.

The name of the network.