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
답변함 일 년 전
  • 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

답변함 일 년 전
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달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인