From 7acc190a23fa8549db1de46c509f1e5959e87b3b Mon Sep 17 00:00:00 2001 From: Bowrna Date: Mon, 7 Mar 2022 03:31:57 +0530 Subject: [PATCH] added docker network_mode options (#21986) --- airflow/decorators/__init__.pyi | 6 ++++++ airflow/providers/docker/operators/docker.py | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/airflow/decorators/__init__.pyi b/airflow/decorators/__init__.pyi index 45cb69c5b0ffd..9ec8c884fe73c 100644 --- a/airflow/decorators/__init__.pyi +++ b/airflow/decorators/__init__.pyi @@ -210,6 +210,12 @@ class TaskDecoratorCollection: :param host_tmp_dir: Specify the location of the temporary directory on the host which will be mapped to tmp_dir. If not provided defaults to using the standard system temp directory. :param network_mode: Network mode for the container. + It can be one of the following: + bridge - Create new network stack for the container with default docker bridge network + None - No networking for this container + container: - Use the network stack of another container specified via + host - Use the host network stack. Incompatible with `port_bindings` + '|' - Connects the container to user created network(using `docker network create` command) :param tls_ca_cert: Path to a PEM-encoded certificate authority to secure the docker connection. :param tls_client_cert: Path to the PEM-encoded certificate diff --git a/airflow/providers/docker/operators/docker.py b/airflow/providers/docker/operators/docker.py index 4eb2560fc54b3..7e0cd3ac49501 100644 --- a/airflow/providers/docker/operators/docker.py +++ b/airflow/providers/docker/operators/docker.py @@ -90,6 +90,13 @@ class DockerOperator(BaseOperator): :param host_tmp_dir: Specify the location of the temporary directory on the host which will be mapped to tmp_dir. If not provided defaults to using the standard system temp directory. :param network_mode: Network mode for the container. + It can be one of the following: + bridge - Create new network stack for the container with default docker bridge network + None - No networking for this container + container: - Use the network stack of another container specified via + host - Use the host network stack. Incompatible with `port_bindings` + '|' - Connects the container to user created network + (using `docker network create` command) :param tls_ca_cert: Path to a PEM-encoded certificate authority to secure the docker connection. :param tls_client_cert: Path to the PEM-encoded certificate