You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2022/03/06 22:02:49 UTC

[airflow] branch main updated: added docker network_mode options (#21986)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 7acc190  added docker network_mode options (#21986)
7acc190 is described below

commit 7acc190a23fa8549db1de46c509f1e5959e87b3b
Author: Bowrna <ma...@gmail.com>
AuthorDate: Mon Mar 7 03:31:57 2022 +0530

    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 45cb69c..9ec8c88 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:<name|id> - Use the network stack of another container specified via <name|id>
+            host - Use the host network stack. Incompatible with `port_bindings`
+            '<network-name>|<network-id>' - 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 4eb2560..7e0cd3a 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:<name|id> - Use the network stack of another container specified via <name|id>
+        host - Use the host network stack. Incompatible with `port_bindings`
+        '<network-name>|<network-id>' - 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