You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/09/13 11:25:47 UTC
[GitHub] [airflow] gontcharovd opened a new pull request #18199: Create docker-operator-with-localexecutor-in-docker-compose.md
gontcharovd opened a new pull request #18199:
URL: https://github.com/apache/airflow/pull/18199
Documentation added as discussed with @mik-laj in the Airflow Slack group.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] mik-laj commented on a change in pull request #18199: Create docker-operator-with-localexecutor-in-docker-compose.md
Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #18199:
URL: https://github.com/apache/airflow/pull/18199#discussion_r707256963
##########
File path: docs/docker-stack/docker-operator-with-localexecutor-in-docker-compose.md
##########
@@ -0,0 +1,87 @@
+# Using the DockerOperator with the LocalExecutor in Docker Compose
+
+This guide will allow you to run the DockerOperator using the LocalExecutor with
+Apache Airflow deployed on Docker Compose. The guide is split into four consecutive steps:
+
+* 1. Preparing the docker-compose.yaml
+* 2. Adding a new services in the docker-compose.yaml
+* 3. Creating a DAG that connects to the Docker API using this proxy
+* 4. Testing the DockerOperator
+
+To deploy Airflow on Docker with Docker Compose you should fetch the docker-compose.yaml:
+
+```
+curl -LfO 'https://airflow.apache.org/docs/apache-airflow/2.1.2/docker-compose.yaml'
+```
+
+For more information about running Airflow in Docker refer to the following
+[documentation](https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html).
+
+## 1. Preparing the docker-compose.yaml
+
+First you need to adapt the standard docker-compose.yaml file to work with
+the LocalExecutor and DockerOperator:
+
+1. line 50: replace `CeleryExecutor` with `LocalExecutor`
+2. line 58: add the `apache-airflow-providers-docker==2.1.0` package to `_PIP_ADDITIONAL_REQUIREMENTS`
+3. comment out or delete lines: 53, 65-66, 85-94, 118-128, 140-150
+
+Note that the apache-airflow-providers version must be 2.1.0 or higher.
+
+You can now initialize the environment with:
+
+```
+docker-compose up airflow-init
+```
+
+## 2. Adding a new services in the docker-compose.yaml
+
+You have to add one additional service to the docker-compose.yaml to use the
+DockerOperator.
+
+```
+# Required because of DockerOperator. For secure access and handling permissions.
+docker-socket-proxy:
+ image: tecnativa/docker-socket-proxy:0.1.1
+ environment:
+ CONTAINERS: 1
+ IMAGES: 1
+ AUTH: 1
+ POST: 1
+ privileged: true
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock:ro
+ restart: always
+```
+
+This service allows to mount the Docker socket more securely.
+You can find more information about this Docker image [here](https://github.com/Tecnativa/docker-socket-proxy).
Review comment:
Please use descriptive link description. See: https://developers.google.com/style/link-text
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] github-actions[bot] closed pull request #18199: Create docker-operator-with-localexecutor-in-docker-compose.md
Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed pull request #18199:
URL: https://github.com/apache/airflow/pull/18199
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] mik-laj commented on a change in pull request #18199: Create docker-operator-with-localexecutor-in-docker-compose.md
Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #18199:
URL: https://github.com/apache/airflow/pull/18199#discussion_r707253614
##########
File path: docs/docker-stack/docker-operator-with-localexecutor-in-docker-compose.md
##########
@@ -0,0 +1,87 @@
+# Using the DockerOperator with the LocalExecutor in Docker Compose
+
+This guide will allow you to run the DockerOperator using the LocalExecutor with
Review comment:
```suggestion
This guide will allow you to run the :ref:`~airflow.providers.docker.operators.docker.DockerOperator` using the LocalExecutor with
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] boring-cyborg[bot] commented on pull request #18199: Create docker-operator-with-localexecutor-in-docker-compose.md
Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on pull request #18199:
URL: https://github.com/apache/airflow/pull/18199#issuecomment-918098003
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
Here are some useful points:
- Pay attention to the quality of your code (flake8, mypy and type annotations). Our [pre-commits]( https://github.com/apache/airflow/blob/main/STATIC_CODE_CHECKS.rst#prerequisites-for-pre-commit-hooks) will help you with that.
- In case of a new feature add useful documentation (in docstrings or in `docs/` directory). Adding a new operator? Check this short [guide](https://github.com/apache/airflow/blob/main/docs/apache-airflow/howto/custom-operator.rst) Consider adding an example DAG that shows how users should use it.
- Consider using [Breeze environment](https://github.com/apache/airflow/blob/main/BREEZE.rst) for testing locally, itโs a heavy docker but it ships with a working Airflow and a lot of integrations.
- Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
- Please follow [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct) for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
- Be sure to read the [Airflow Coding style]( https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#coding-style-and-best-practices).
Apache Airflow is a community-driven project and together we are making it better ๐.
In case of doubts contact the developers at:
Mailing List: dev@airflow.apache.org
Slack: https://s.apache.org/airflow-slack
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] mik-laj commented on a change in pull request #18199: Create docker-operator-with-localexecutor-in-docker-compose.md
Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #18199:
URL: https://github.com/apache/airflow/pull/18199#discussion_r707262215
##########
File path: docs/docker-stack/docker-operator-with-localexecutor-in-docker-compose.md
##########
@@ -0,0 +1,87 @@
+# Using the DockerOperator with the LocalExecutor in Docker Compose
+
+This guide will allow you to run the DockerOperator using the LocalExecutor with
+Apache Airflow deployed on Docker Compose. The guide is split into four consecutive steps:
+
+* 1. Preparing the docker-compose.yaml
+* 2. Adding a new services in the docker-compose.yaml
+* 3. Creating a DAG that connects to the Docker API using this proxy
+* 4. Testing the DockerOperator
+
+To deploy Airflow on Docker with Docker Compose you should fetch the docker-compose.yaml:
+
+```
+curl -LfO 'https://airflow.apache.org/docs/apache-airflow/2.1.2/docker-compose.yaml'
+```
+
+For more information about running Airflow in Docker refer to the following
+[documentation](https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html).
+
+## 1. Preparing the docker-compose.yaml
+
+First you need to adapt the standard docker-compose.yaml file to work with
+the LocalExecutor and DockerOperator:
+
+1. line 50: replace `CeleryExecutor` with `LocalExecutor`
+2. line 58: add the `apache-airflow-providers-docker==2.1.0` package to `_PIP_ADDITIONAL_REQUIREMENTS`
+3. comment out or delete lines: 53, 65-66, 85-94, 118-128, 140-150
+
+Note that the apache-airflow-providers version must be 2.1.0 or higher.
+
+You can now initialize the environment with:
+
+```
+docker-compose up airflow-init
+```
+
+## 2. Adding a new services in the docker-compose.yaml
+
+You have to add one additional service to the docker-compose.yaml to use the
+DockerOperator.
+
+```
+# Required because of DockerOperator. For secure access and handling permissions.
+docker-socket-proxy:
+ image: tecnativa/docker-socket-proxy:0.1.1
+ environment:
+ CONTAINERS: 1
+ IMAGES: 1
+ AUTH: 1
+ POST: 1
+ privileged: true
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock:ro
+ restart: always
+```
+
+This service allows to mount the Docker socket more securely.
+You can find more information about this Docker image [here](https://github.com/Tecnativa/docker-socket-proxy).
+
+## 3. Creating a DAG that connects to the Docker API using this proxy
+
+Below is an example DAG that uses the DockerOperator:
Review comment:
Below is a command that will fetch an example, but it's not an example.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] mik-laj commented on a change in pull request #18199: Create docker-operator-with-localexecutor-in-docker-compose.md
Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #18199:
URL: https://github.com/apache/airflow/pull/18199#discussion_r707255752
##########
File path: docs/docker-stack/docker-operator-with-localexecutor-in-docker-compose.md
##########
@@ -0,0 +1,87 @@
+# Using the DockerOperator with the LocalExecutor in Docker Compose
+
+This guide will allow you to run the DockerOperator using the LocalExecutor with
+Apache Airflow deployed on Docker Compose. The guide is split into four consecutive steps:
+
+* 1. Preparing the docker-compose.yaml
+* 2. Adding a new services in the docker-compose.yaml
+* 3. Creating a DAG that connects to the Docker API using this proxy
+* 4. Testing the DockerOperator
+
+To deploy Airflow on Docker with Docker Compose you should fetch the docker-compose.yaml:
+
+```
+curl -LfO 'https://airflow.apache.org/docs/apache-airflow/2.1.2/docker-compose.yaml'
+```
+
+For more information about running Airflow in Docker refer to the following
+[documentation](https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html).
+
+## 1. Preparing the docker-compose.yaml
+
+First you need to adapt the standard docker-compose.yaml file to work with
+the LocalExecutor and DockerOperator:
+
+1. line 50: replace `CeleryExecutor` with `LocalExecutor`
Review comment:
I wonder if it is worth dividing it into two guides. One that will describe how to use LocalExecutor and the other how to use Docker Operator.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] mik-laj commented on a change in pull request #18199: Create docker-operator-with-localexecutor-in-docker-compose.md
Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #18199:
URL: https://github.com/apache/airflow/pull/18199#discussion_r707372287
##########
File path: docs/docker-stack/docker-operator-with-localexecutor-in-docker-compose.md
##########
@@ -0,0 +1,87 @@
+# Using the DockerOperator with the LocalExecutor in Docker Compose
+
+This guide will allow you to run the DockerOperator using the LocalExecutor with
+Apache Airflow deployed on Docker Compose. The guide is split into four consecutive steps:
+
+* 1. Preparing the docker-compose.yaml
+* 2. Adding a new services in the docker-compose.yaml
+* 3. Creating a DAG that connects to the Docker API using this proxy
+* 4. Testing the DockerOperator
+
+To deploy Airflow on Docker with Docker Compose you should fetch the docker-compose.yaml:
+
+```
+curl -LfO 'https://airflow.apache.org/docs/apache-airflow/2.1.2/docker-compose.yaml'
+```
+
+For more information about running Airflow in Docker refer to the following
+[documentation](https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html).
+
+## 1. Preparing the docker-compose.yaml
+
+First you need to adapt the standard docker-compose.yaml file to work with
+the LocalExecutor and DockerOperator:
+
+1. line 50: replace `CeleryExecutor` with `LocalExecutor`
+2. line 58: add the `apache-airflow-providers-docker==2.1.0` package to `_PIP_ADDITIONAL_REQUIREMENTS`
+3. comment out or delete lines: 53, 65-66, 85-94, 118-128, 140-150
+
+Note that the apache-airflow-providers version must be 2.1.0 or higher.
+
+You can now initialize the environment with:
+
+```
+docker-compose up airflow-init
+```
+
+## 2. Adding a new services in the docker-compose.yaml
+
+You have to add one additional service to the docker-compose.yaml to use the
+DockerOperator.
+
+```
+# Required because of DockerOperator. For secure access and handling permissions.
+docker-socket-proxy:
+ image: tecnativa/docker-socket-proxy:0.1.1
+ environment:
+ CONTAINERS: 1
+ IMAGES: 1
+ AUTH: 1
+ POST: 1
+ privileged: true
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock:ro
+ restart: always
+```
+
+This service allows to mount the Docker socket more securely.
+You can find more information about this Docker image [here](https://github.com/Tecnativa/docker-socket-proxy).
+
+## 3. Creating a DAG that connects to the Docker API using this proxy
+
+Below is an example DAG that uses the DockerOperator:
+
+```
+curl -LfO 'https://raw.githubusercontent.com/apache/airflow/main/airflow/providers/docker/example_dags/example_docker.py'
+```
+
+Place this file inside the dags/ folder.
+
+You have to modify the task `t3` that uses the DockerOperator for it to work with the
+docker-socker-proxy:
Review comment:
```suggestion
``docker-socket-proxy``:
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] uranusjr commented on pull request #18199: Create docker-operator-with-localexecutor-in-docker-compose.md
Posted by GitBox <gi...@apache.org>.
uranusjr commented on pull request #18199:
URL: https://github.com/apache/airflow/pull/18199#issuecomment-937422424
Gentle ping on this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] github-actions[bot] commented on pull request #18199: Create docker-operator-with-localexecutor-in-docker-compose.md
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #18199:
URL: https://github.com/apache/airflow/pull/18199#issuecomment-974926154
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] mik-laj commented on a change in pull request #18199: Create docker-operator-with-localexecutor-in-docker-compose.md
Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #18199:
URL: https://github.com/apache/airflow/pull/18199#discussion_r707249940
##########
File path: docs/docker-stack/docker-operator-with-localexecutor-in-docker-compose.md
##########
@@ -0,0 +1,87 @@
+# Using the DockerOperator with the LocalExecutor in Docker Compose
+
+This guide will allow you to run the DockerOperator using the LocalExecutor with
+Apache Airflow deployed on Docker Compose. The guide is split into four consecutive steps:
+
+* 1. Preparing the docker-compose.yaml
+* 2. Adding a new services in the docker-compose.yaml
+* 3. Creating a DAG that connects to the Docker API using this proxy
+* 4. Testing the DockerOperator
+
+To deploy Airflow on Docker with Docker Compose you should fetch the docker-compose.yaml:
+
+```
+curl -LfO 'https://airflow.apache.org/docs/apache-airflow/2.1.2/docker-compose.yaml'
+```
+
+For more information about running Airflow in Docker refer to the following
+[documentation](https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html).
+
+## 1. Preparing the docker-compose.yaml
+
+First you need to adapt the standard docker-compose.yaml file to work with
+the LocalExecutor and DockerOperator:
+
+1. line 50: replace `CeleryExecutor` with `LocalExecutor`
+2. line 58: add the `apache-airflow-providers-docker==2.1.0` package to `_PIP_ADDITIONAL_REQUIREMENTS`
+3. comment out or delete lines: 53, 65-66, 85-94, 118-128, 140-150
+
+Note that the apache-airflow-providers version must be 2.1.0 or higher.
+
+You can now initialize the environment with:
+
+```
+docker-compose up airflow-init
+```
+
+## 2. Adding a new services in the docker-compose.yaml
+
+You have to add one additional service to the docker-compose.yaml to use the
+DockerOperator.
+
+```
+# Required because of DockerOperator. For secure access and handling permissions.
+docker-socket-proxy:
+ image: tecnativa/docker-socket-proxy:0.1.1
+ environment:
+ CONTAINERS: 1
+ IMAGES: 1
+ AUTH: 1
+ POST: 1
+ privileged: true
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock:ro
+ restart: always
+```
+
+This service allows to mount the Docker socket more securely.
+You can find more information about this Docker image [here](https://github.com/Tecnativa/docker-socket-proxy).
+
+## 3. Creating a DAG that connects to the Docker API using this proxy
+
+Below is an example DAG that uses the DockerOperator:
+
+```
+curl -LfO 'https://raw.githubusercontent.com/apache/airflow/main/airflow/providers/docker/example_dags/example_docker.py'
+```
+
+Place this file inside the dags/ folder.
+
+You have to modify the task `t3` that uses the DockerOperator for it to work with the
+docker-socker-proxy:
+
+* line 45: set the `api_version` to at least `1.30`
+* line 46: replace `localhost` with `docker-socket-proxy`
+* line 47: change the command to `"echo TEST DOCKER SUCCESSFUL"`
Review comment:
Can you use diff to show the required changes?
```diff
t3 = DockerOperator(
- api_version='1.19',
+ api_version='1.30',
- docker_url='tcp://localhost:2375', # Set your docker URL
+ docker_url='tcp://docker-socket-proxy:2375', # Set your docker URL
- command='/bin/sleep 30',
+ command="echo TEST DOCKER SUCCESSFUL",
image='centos:latest',
network_mode='bridge',
task_id='docker_op_tester',
dag=dag,
)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] mik-laj commented on a change in pull request #18199: Create docker-operator-with-localexecutor-in-docker-compose.md
Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #18199:
URL: https://github.com/apache/airflow/pull/18199#discussion_r707261533
##########
File path: docs/docker-stack/docker-operator-with-localexecutor-in-docker-compose.md
##########
@@ -0,0 +1,87 @@
+# Using the DockerOperator with the LocalExecutor in Docker Compose
+
+This guide will allow you to run the DockerOperator using the LocalExecutor with
+Apache Airflow deployed on Docker Compose. The guide is split into four consecutive steps:
+
+* 1. Preparing the docker-compose.yaml
+* 2. Adding a new services in the docker-compose.yaml
Review comment:
```suggestion
* 2. Adding a new services in the ``docker-compose.yaml`` file.
```
See: https://developers.google.com/style/filenames
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] mik-laj commented on a change in pull request #18199: Create docker-operator-with-localexecutor-in-docker-compose.md
Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #18199:
URL: https://github.com/apache/airflow/pull/18199#discussion_r707252924
##########
File path: docs/docker-stack/docker-operator-with-localexecutor-in-docker-compose.md
##########
@@ -0,0 +1,87 @@
+# Using the DockerOperator with the LocalExecutor in Docker Compose
Review comment:
What do you think to add this guide to the `recipes.rst` file?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] mik-laj commented on a change in pull request #18199: Create docker-operator-with-localexecutor-in-docker-compose.md
Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #18199:
URL: https://github.com/apache/airflow/pull/18199#discussion_r707249377
##########
File path: docs/docker-stack/docker-operator-with-localexecutor-in-docker-compose.md
##########
@@ -0,0 +1,87 @@
+# Using the DockerOperator with the LocalExecutor in Docker Compose
+
+This guide will allow you to run the DockerOperator using the LocalExecutor with
+Apache Airflow deployed on Docker Compose. The guide is split into four consecutive steps:
+
+* 1. Preparing the docker-compose.yaml
+* 2. Adding a new services in the docker-compose.yaml
+* 3. Creating a DAG that connects to the Docker API using this proxy
+* 4. Testing the DockerOperator
+
+To deploy Airflow on Docker with Docker Compose you should fetch the docker-compose.yaml:
+
+```
+curl -LfO 'https://airflow.apache.org/docs/apache-airflow/2.1.2/docker-compose.yaml'
+```
+
+For more information about running Airflow in Docker refer to the following
+[documentation](https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html).
+
+## 1. Preparing the docker-compose.yaml
+
+First you need to adapt the standard docker-compose.yaml file to work with
+the LocalExecutor and DockerOperator:
+
+1. line 50: replace `CeleryExecutor` with `LocalExecutor`
+2. line 58: add the `apache-airflow-providers-docker==2.1.0` package to `_PIP_ADDITIONAL_REQUIREMENTS`
+3. comment out or delete lines: 53, 65-66, 85-94, 118-128, 140-150
Review comment:
Can you describe these changes in more detail?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] mik-laj commented on a change in pull request #18199: Create docker-operator-with-localexecutor-in-docker-compose.md
Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #18199:
URL: https://github.com/apache/airflow/pull/18199#discussion_r707254004
##########
File path: docs/docker-stack/docker-operator-with-localexecutor-in-docker-compose.md
##########
@@ -0,0 +1,87 @@
+# Using the DockerOperator with the LocalExecutor in Docker Compose
+
+This guide will allow you to run the DockerOperator using the LocalExecutor with
+Apache Airflow deployed on Docker Compose. The guide is split into four consecutive steps:
+
Review comment:
What do you think about adding this guide to `recipes.rst` file?
##########
File path: docs/docker-stack/docker-operator-with-localexecutor-in-docker-compose.md
##########
@@ -0,0 +1,87 @@
+# Using the DockerOperator with the LocalExecutor in Docker Compose
+
+This guide will allow you to run the DockerOperator using the LocalExecutor with
+Apache Airflow deployed on Docker Compose. The guide is split into four consecutive steps:
+
+* 1. Preparing the docker-compose.yaml
Review comment:
```suggestion
* 1. Preparing the ``docker-compose.yaml`` file
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] mik-laj commented on a change in pull request #18199: Create docker-operator-with-localexecutor-in-docker-compose.md
Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #18199:
URL: https://github.com/apache/airflow/pull/18199#discussion_r707249940
##########
File path: docs/docker-stack/docker-operator-with-localexecutor-in-docker-compose.md
##########
@@ -0,0 +1,87 @@
+# Using the DockerOperator with the LocalExecutor in Docker Compose
+
+This guide will allow you to run the DockerOperator using the LocalExecutor with
+Apache Airflow deployed on Docker Compose. The guide is split into four consecutive steps:
+
+* 1. Preparing the docker-compose.yaml
+* 2. Adding a new services in the docker-compose.yaml
+* 3. Creating a DAG that connects to the Docker API using this proxy
+* 4. Testing the DockerOperator
+
+To deploy Airflow on Docker with Docker Compose you should fetch the docker-compose.yaml:
+
+```
+curl -LfO 'https://airflow.apache.org/docs/apache-airflow/2.1.2/docker-compose.yaml'
+```
+
+For more information about running Airflow in Docker refer to the following
+[documentation](https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html).
+
+## 1. Preparing the docker-compose.yaml
+
+First you need to adapt the standard docker-compose.yaml file to work with
+the LocalExecutor and DockerOperator:
+
+1. line 50: replace `CeleryExecutor` with `LocalExecutor`
+2. line 58: add the `apache-airflow-providers-docker==2.1.0` package to `_PIP_ADDITIONAL_REQUIREMENTS`
+3. comment out or delete lines: 53, 65-66, 85-94, 118-128, 140-150
+
+Note that the apache-airflow-providers version must be 2.1.0 or higher.
+
+You can now initialize the environment with:
+
+```
+docker-compose up airflow-init
+```
+
+## 2. Adding a new services in the docker-compose.yaml
+
+You have to add one additional service to the docker-compose.yaml to use the
+DockerOperator.
+
+```
+# Required because of DockerOperator. For secure access and handling permissions.
+docker-socket-proxy:
+ image: tecnativa/docker-socket-proxy:0.1.1
+ environment:
+ CONTAINERS: 1
+ IMAGES: 1
+ AUTH: 1
+ POST: 1
+ privileged: true
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock:ro
+ restart: always
+```
+
+This service allows to mount the Docker socket more securely.
+You can find more information about this Docker image [here](https://github.com/Tecnativa/docker-socket-proxy).
+
+## 3. Creating a DAG that connects to the Docker API using this proxy
+
+Below is an example DAG that uses the DockerOperator:
+
+```
+curl -LfO 'https://raw.githubusercontent.com/apache/airflow/main/airflow/providers/docker/example_dags/example_docker.py'
+```
+
+Place this file inside the dags/ folder.
+
+You have to modify the task `t3` that uses the DockerOperator for it to work with the
+docker-socker-proxy:
+
+* line 45: set the `api_version` to at least `1.30`
+* line 46: replace `localhost` with `docker-socket-proxy`
+* line 47: change the command to `"echo TEST DOCKER SUCCESSFUL"`
Review comment:
Can you use diff to show the required changes?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] mik-laj commented on a change in pull request #18199: Create docker-operator-with-localexecutor-in-docker-compose.md
Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #18199:
URL: https://github.com/apache/airflow/pull/18199#discussion_r707257989
##########
File path: docs/docker-stack/docker-operator-with-localexecutor-in-docker-compose.md
##########
@@ -0,0 +1,87 @@
+# Using the DockerOperator with the LocalExecutor in Docker Compose
+
+This guide will allow you to run the DockerOperator using the LocalExecutor with
+Apache Airflow deployed on Docker Compose. The guide is split into four consecutive steps:
+
+* 1. Preparing the docker-compose.yaml
+* 2. Adding a new services in the docker-compose.yaml
+* 3. Creating a DAG that connects to the Docker API using this proxy
+* 4. Testing the DockerOperator
+
+To deploy Airflow on Docker with Docker Compose you should fetch the docker-compose.yaml:
+
+```
+curl -LfO 'https://airflow.apache.org/docs/apache-airflow/2.1.2/docker-compose.yaml'
+```
+
+For more information about running Airflow in Docker refer to the following
+[documentation](https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html).
+
+## 1. Preparing the docker-compose.yaml
+
+First you need to adapt the standard docker-compose.yaml file to work with
+the LocalExecutor and DockerOperator:
+
+1. line 50: replace `CeleryExecutor` with `LocalExecutor`
+2. line 58: add the `apache-airflow-providers-docker==2.1.0` package to `_PIP_ADDITIONAL_REQUIREMENTS`
+3. comment out or delete lines: 53, 65-66, 85-94, 118-128, 140-150
+
+Note that the apache-airflow-providers version must be 2.1.0 or higher.
+
+You can now initialize the environment with:
+
+```
+docker-compose up airflow-init
+```
+
+## 2. Adding a new services in the docker-compose.yaml
+
+You have to add one additional service to the docker-compose.yaml to use the
+DockerOperator.
+
+```
+# Required because of DockerOperator. For secure access and handling permissions.
+docker-socket-proxy:
+ image: tecnativa/docker-socket-proxy:0.1.1
+ environment:
+ CONTAINERS: 1
+ IMAGES: 1
+ AUTH: 1
+ POST: 1
+ privileged: true
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock:ro
+ restart: always
+```
+
+This service allows to mount the Docker socket more securely.
+You can find more information about this Docker image [here](https://github.com/Tecnativa/docker-socket-proxy).
+
+## 3. Creating a DAG that connects to the Docker API using this proxy
+
+Below is an example DAG that uses the DockerOperator:
+
+```
+curl -LfO 'https://raw.githubusercontent.com/apache/airflow/main/airflow/providers/docker/example_dags/example_docker.py'
+```
+
+Place this file inside the dags/ folder.
+
+You have to modify the task `t3` that uses the DockerOperator for it to work with the
+docker-socker-proxy:
+
+* line 45: set the `api_version` to at least `1.30`
Review comment:
Can you describe why this is necessary?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] mik-laj commented on a change in pull request #18199: Create docker-operator-with-localexecutor-in-docker-compose.md
Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #18199:
URL: https://github.com/apache/airflow/pull/18199#discussion_r707257718
##########
File path: docs/docker-stack/docker-operator-with-localexecutor-in-docker-compose.md
##########
@@ -0,0 +1,87 @@
+# Using the DockerOperator with the LocalExecutor in Docker Compose
+
+This guide will allow you to run the DockerOperator using the LocalExecutor with
+Apache Airflow deployed on Docker Compose. The guide is split into four consecutive steps:
+
+* 1. Preparing the docker-compose.yaml
+* 2. Adding a new services in the docker-compose.yaml
+* 3. Creating a DAG that connects to the Docker API using this proxy
+* 4. Testing the DockerOperator
+
+To deploy Airflow on Docker with Docker Compose you should fetch the docker-compose.yaml:
+
+```
+curl -LfO 'https://airflow.apache.org/docs/apache-airflow/2.1.2/docker-compose.yaml'
+```
+
+For more information about running Airflow in Docker refer to the following
+[documentation](https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html).
+
+## 1. Preparing the docker-compose.yaml
+
+First you need to adapt the standard docker-compose.yaml file to work with
+the LocalExecutor and DockerOperator:
+
+1. line 50: replace `CeleryExecutor` with `LocalExecutor`
+2. line 58: add the `apache-airflow-providers-docker==2.1.0` package to `_PIP_ADDITIONAL_REQUIREMENTS`
+3. comment out or delete lines: 53, 65-66, 85-94, 118-128, 140-150
+
+Note that the apache-airflow-providers version must be 2.1.0 or higher.
+
+You can now initialize the environment with:
+
+```
+docker-compose up airflow-init
+```
+
+## 2. Adding a new services in the docker-compose.yaml
+
+You have to add one additional service to the docker-compose.yaml to use the
+DockerOperator.
+
+```
+# Required because of DockerOperator. For secure access and handling permissions.
+docker-socket-proxy:
+ image: tecnativa/docker-socket-proxy:0.1.1
+ environment:
+ CONTAINERS: 1
+ IMAGES: 1
+ AUTH: 1
+ POST: 1
+ privileged: true
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock:ro
+ restart: always
+```
+
+This service allows to mount the Docker socket more securely.
+You can find more information about this Docker image [here](https://github.com/Tecnativa/docker-socket-proxy).
+
+## 3. Creating a DAG that connects to the Docker API using this proxy
Review comment:
I wonder if it would be better to just paste a ready DAG file with one task.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] mik-laj commented on a change in pull request #18199: Create docker-operator-with-localexecutor-in-docker-compose.md
Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #18199:
URL: https://github.com/apache/airflow/pull/18199#discussion_r707251680
##########
File path: docs/docker-stack/docker-operator-with-localexecutor-in-docker-compose.md
##########
@@ -0,0 +1,87 @@
+# Using the DockerOperator with the LocalExecutor in Docker Compose
Review comment:
This file should be formatted using RST syntax.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] mik-laj commented on a change in pull request #18199: Create docker-operator-with-localexecutor-in-docker-compose.md
Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #18199:
URL: https://github.com/apache/airflow/pull/18199#discussion_r707371860
##########
File path: docs/docker-stack/docker-operator-with-localexecutor-in-docker-compose.md
##########
@@ -0,0 +1,87 @@
+# Using the DockerOperator with the LocalExecutor in Docker Compose
+
+This guide will allow you to run the DockerOperator using the LocalExecutor with
+Apache Airflow deployed on Docker Compose. The guide is split into four consecutive steps:
+
+* 1. Preparing the docker-compose.yaml
+* 2. Adding a new services in the docker-compose.yaml
+* 3. Creating a DAG that connects to the Docker API using this proxy
+* 4. Testing the DockerOperator
+
+To deploy Airflow on Docker with Docker Compose you should fetch the docker-compose.yaml:
+
+```
+curl -LfO 'https://airflow.apache.org/docs/apache-airflow/2.1.2/docker-compose.yaml'
+```
+
+For more information about running Airflow in Docker refer to the following
+[documentation](https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html).
+
+## 1. Preparing the docker-compose.yaml
+
+First you need to adapt the standard docker-compose.yaml file to work with
+the LocalExecutor and DockerOperator:
+
+1. line 50: replace `CeleryExecutor` with `LocalExecutor`
+2. line 58: add the `apache-airflow-providers-docker==2.1.0` package to `_PIP_ADDITIONAL_REQUIREMENTS`
+3. comment out or delete lines: 53, 65-66, 85-94, 118-128, 140-150
+
+Note that the apache-airflow-providers version must be 2.1.0 or higher.
+
+You can now initialize the environment with:
+
+```
+docker-compose up airflow-init
+```
+
+## 2. Adding a new services in the docker-compose.yaml
+
+You have to add one additional service to the docker-compose.yaml to use the
+DockerOperator.
+
+```
+# Required because of DockerOperator. For secure access and handling permissions.
+docker-socket-proxy:
+ image: tecnativa/docker-socket-proxy:0.1.1
+ environment:
+ CONTAINERS: 1
+ IMAGES: 1
+ AUTH: 1
+ POST: 1
+ privileged: true
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock:ro
+ restart: always
+```
+
+This service allows to mount the Docker socket more securely.
+You can find more information about this Docker image [here](https://github.com/Tecnativa/docker-socket-proxy).
+
+## 3. Creating a DAG that connects to the Docker API using this proxy
+
+Below is an example DAG that uses the DockerOperator:
+
+```
+curl -LfO 'https://raw.githubusercontent.com/apache/airflow/main/airflow/providers/docker/example_dags/example_docker.py'
+```
+
+Place this file inside the dags/ folder.
Review comment:
```suggestion
Place this file inside the `dags/` folder.
```
We should put path in code font. See: https://developers.google.com/style/code-in-text
##########
File path: docs/docker-stack/docker-operator-with-localexecutor-in-docker-compose.md
##########
@@ -0,0 +1,87 @@
+# Using the DockerOperator with the LocalExecutor in Docker Compose
+
+This guide will allow you to run the DockerOperator using the LocalExecutor with
+Apache Airflow deployed on Docker Compose. The guide is split into four consecutive steps:
+
+* 1. Preparing the docker-compose.yaml
+* 2. Adding a new services in the docker-compose.yaml
+* 3. Creating a DAG that connects to the Docker API using this proxy
+* 4. Testing the DockerOperator
+
+To deploy Airflow on Docker with Docker Compose you should fetch the docker-compose.yaml:
+
+```
+curl -LfO 'https://airflow.apache.org/docs/apache-airflow/2.1.2/docker-compose.yaml'
+```
+
+For more information about running Airflow in Docker refer to the following
+[documentation](https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html).
+
+## 1. Preparing the docker-compose.yaml
+
+First you need to adapt the standard docker-compose.yaml file to work with
+the LocalExecutor and DockerOperator:
+
+1. line 50: replace `CeleryExecutor` with `LocalExecutor`
+2. line 58: add the `apache-airflow-providers-docker==2.1.0` package to `_PIP_ADDITIONAL_REQUIREMENTS`
+3. comment out or delete lines: 53, 65-66, 85-94, 118-128, 140-150
+
+Note that the apache-airflow-providers version must be 2.1.0 or higher.
+
+You can now initialize the environment with:
+
+```
+docker-compose up airflow-init
+```
+
+## 2. Adding a new services in the docker-compose.yaml
+
+You have to add one additional service to the docker-compose.yaml to use the
+DockerOperator.
+
+```
+# Required because of DockerOperator. For secure access and handling permissions.
+docker-socket-proxy:
+ image: tecnativa/docker-socket-proxy:0.1.1
+ environment:
+ CONTAINERS: 1
+ IMAGES: 1
+ AUTH: 1
+ POST: 1
+ privileged: true
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock:ro
+ restart: always
+```
+
+This service allows to mount the Docker socket more securely.
+You can find more information about this Docker image [here](https://github.com/Tecnativa/docker-socket-proxy).
+
+## 3. Creating a DAG that connects to the Docker API using this proxy
+
+Below is an example DAG that uses the DockerOperator:
+
+```
+curl -LfO 'https://raw.githubusercontent.com/apache/airflow/main/airflow/providers/docker/example_dags/example_docker.py'
+```
+
+Place this file inside the dags/ folder.
+
+You have to modify the task `t3` that uses the DockerOperator for it to work with the
Review comment:
```suggestion
You have to modify the task `t3` that uses the ``DockerOperator`` for it to work with the
```
##########
File path: docs/docker-stack/docker-operator-with-localexecutor-in-docker-compose.md
##########
@@ -0,0 +1,87 @@
+# Using the DockerOperator with the LocalExecutor in Docker Compose
+
+This guide will allow you to run the DockerOperator using the LocalExecutor with
+Apache Airflow deployed on Docker Compose. The guide is split into four consecutive steps:
+
+* 1. Preparing the docker-compose.yaml
+* 2. Adding a new services in the docker-compose.yaml
+* 3. Creating a DAG that connects to the Docker API using this proxy
+* 4. Testing the DockerOperator
+
+To deploy Airflow on Docker with Docker Compose you should fetch the docker-compose.yaml:
+
+```
+curl -LfO 'https://airflow.apache.org/docs/apache-airflow/2.1.2/docker-compose.yaml'
+```
+
+For more information about running Airflow in Docker refer to the following
+[documentation](https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html).
+
+## 1. Preparing the docker-compose.yaml
+
+First you need to adapt the standard docker-compose.yaml file to work with
+the LocalExecutor and DockerOperator:
+
+1. line 50: replace `CeleryExecutor` with `LocalExecutor`
+2. line 58: add the `apache-airflow-providers-docker==2.1.0` package to `_PIP_ADDITIONAL_REQUIREMENTS`
+3. comment out or delete lines: 53, 65-66, 85-94, 118-128, 140-150
+
+Note that the apache-airflow-providers version must be 2.1.0 or higher.
+
+You can now initialize the environment with:
+
+```
+docker-compose up airflow-init
+```
+
+## 2. Adding a new services in the docker-compose.yaml
+
+You have to add one additional service to the docker-compose.yaml to use the
+DockerOperator.
+
+```
+# Required because of DockerOperator. For secure access and handling permissions.
+docker-socket-proxy:
+ image: tecnativa/docker-socket-proxy:0.1.1
+ environment:
+ CONTAINERS: 1
+ IMAGES: 1
+ AUTH: 1
+ POST: 1
+ privileged: true
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock:ro
+ restart: always
+```
+
+This service allows to mount the Docker socket more securely.
+You can find more information about this Docker image [here](https://github.com/Tecnativa/docker-socket-proxy).
+
+## 3. Creating a DAG that connects to the Docker API using this proxy
+
+Below is an example DAG that uses the DockerOperator:
+
+```
+curl -LfO 'https://raw.githubusercontent.com/apache/airflow/main/airflow/providers/docker/example_dags/example_docker.py'
+```
+
+Place this file inside the dags/ folder.
+
+You have to modify the task `t3` that uses the DockerOperator for it to work with the
+docker-socker-proxy:
Review comment:
```suggestion
``docker-socker-proxy``:
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] uranusjr commented on pull request #18199: Create docker-operator-with-localexecutor-in-docker-compose.md
Posted by GitBox <gi...@apache.org>.
uranusjr commented on pull request #18199:
URL: https://github.com/apache/airflow/pull/18199#issuecomment-937422424
Gentle ping on this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org