Commit 25f54dd3 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Add docker.Container.disconnect() method

parent c76e5e6e
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -447,6 +447,16 @@ class Container:
		)
		docker(b"network", b"connect", *opts, str(network), contrid)

	def disconnect(self, network: Network) -> None:
		"""
		Disconnect the container from a Docker network

		Raises `KeyError` if the network was not connected to with `Container.connect()`.
		"""
		del self.networks[network]
		if self.cid is not None:
			docker(b"network", b"disconnect", str(network), self.cid)

	def show_logs(self) -> None:
		"""
		Print the container logs to stdout