Airflow Docker Operator MWAA

0

Hi I am trying to run docker operator of aifrlow on mwaa with docker image present on was ecr so need guidance on that thanks

3 回答
0

Hello,

Please follow below steps

  1. Once the docker image is pushed to ECR, you will need to make a Docker Registry connection on Airflow UI. Make sure to choose connection type as "Docker Registry" and Username as "AWS". Password is the string that you get when running "aws ecr get-login-password --region us-east-1"

  2. Write your DAG, and specify the docker_conn_id with the name you chose above. Make sure your provided docker URL is correct. Also, make sure that the docker host has access from the MWAA Security group.

Below is the sample Dag

from airflow import DAG from datetime import datetime, timedelta import json, csv, requests from airflow.operators.docker_operator import DockerOperator

default_args = { "owner": "xxxxx", "start_date": datetime(2020, 11, 29), "depends_on_past": False, "email_on_failure": False, "email_on_retry": False, "email": "xxxx@xxx.com", "retries": 1, "retry_delay": timedelta(minutes=5) }

with DAG(dag_id="docker-test", schedule_interval="@hourly", default_args=default_args, catchup=False) as dag:

docker_test_task = DockerOperator(
    task_id='docker_task',
    image='123456789012.dkr.ecr.us-east-1.amazonaws.com/airflow-docker-rep:latest',
    execution_timeout=timedelta(minutes=30),
    docker_conn_id='docker',
    api_version='auto',
    docker_url='tcp://ec2-11-222-333-444.compute-1.amazonaws.com:1111'
)

docker_test_task

AWS
已回答 1 年前
  • Can you clarify what you mean by "Also, make sure that the docker host has access from the MWAA Security group." Does that mean that in order to use the DockerOperator in MWAA, I need to be running an additional ec2 instance running docker?

0

thanks for answer

已回答 1 年前
0

Hello, Please clarify the "docker host has access from the MWAA Security group". Also, could you give us information about where to get the docker_url : docker_url='tcp://ec2-11-222-333-444.compute-1.amazonaws.com:1111'

Lorena
已回答 5 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则