hussein-awala commented on issue #29103:
URL: https://github.com/apache/airflow/issues/29103#issuecomment-1400897972

   #28996 tested and working as expected
   ```python
   import pendulum
   
   from airflow.providers.docker.operators.docker import DockerOperator
   from airflow.models import DAG
   
   default_args = {}
   
   
   with DAG(
       dag_id='docker_operators',
       default_args=default_args,
       start_date=pendulum.datetime(2021, 1, 1, tz="UTC"),
       schedule=None
   ) as dag:
       docker1 = DockerOperator(
           task_id="alpine_should_success",
           image="alpine",
           container_name="docker1",
           command="echo 1",
           auto_remove="success",
           docker_url="unix://var/run/docker.sock",
           skip_exit_code=50,
       )
   
       docker2 = DockerOperator(
           task_id="alpine_should_skip",
           image="alpine",
           container_name="docker2",
           command='sh -c "exit 50"',
           auto_remove="success",
           docker_url="unix://var/run/docker.sock",
           skip_exit_code=50,
       )
   
       docker3 = DockerOperator(
           task_id="alpine_should_fail",
           image="alpine",
           container_name="docker3",
           command='sh -c "exit 50"',
           auto_remove="success",
           docker_url="unix://var/run/docker.sock",
       )
   
       docker4 = DockerOperator(
           task_id="python_should_skip",
           image="python",
           container_name="docker4",
           command="python -c 'print(1); exit(50)'",
           auto_remove="success",
           docker_url="unix://var/run/docker.sock",
           skip_exit_code=50,
       )
   
       docker5 = DockerOperator(
           task_id="python_should_fail",
           image="python",
           container_name="docker5",
           command="python -c 'print(1); exit(50)'",
           auto_remove="success",
           docker_url="unix://var/run/docker.sock",
       )
   ```
   
![image](https://user-images.githubusercontent.com/21311487/214136942-aae5edfe-1fe6-4714-8637-9dab26398468.png)
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to