raphaelauv edited a comment on issue #17268:
URL: https://github.com/apache/airflow/issues/17268#issuecomment-887784405


   for docker 2.1.0rc2 it's all good
   
   docker in docker work and also the XCOM
   
   --------
   
   ```
   t3 = DockerOperator(
       api_version='auto',
       docker_url="unix://var/run/docker.sock",
       command='/bin/echo toto',
       image='centos:latest',
       network_mode='bridge',
       mount_tmp_dir=False,
       do_xcom_push=True,
       task_id='docker_op_tester',
       dag=dag,
   )
   ```
   
   give 
   
   ```
   [2021-07-27 19:38:44,647] {docker.py:246} INFO - Starting docker container 
from image centos:latest
   [2021-07-27 19:38:44,682] {docker.py:256} WARNING - Using remote engine or 
docker-in-docker and mounting temporary volume from host is not supported. 
Falling back to `mount_tmp_dir=False` mode. You can set `mount_tmp_dir` 
parameter to False to disable mounting and remove the warning
   [2021-07-27 19:38:46,975] {docker.py:307} INFO - toto
   [2021-07-27 19:38:47,664] {taskinstance.py:1204} INFO - Marking task as 
SUCCESS. dag_id=docker_sample, task_id=docker_op_tester, 
execution_date=20210727T150000, start_date=20210727T193839, 
end_date=20210727T193847
   [2021-07-27 19:38:47,770] {taskinstance.py:1265} INFO - 0 downstream tasks 
scheduled from follow-on schedule check
   [2021-07-27 19:38:47,815] {local_task_job.py:149} INFO - Task exited with 
return code 0
   ```
   and 
   
   ```
   t3 = DockerOperator(
       api_version='auto',
       docker_url="unix://var/run/docker.sock",
       command='/bin/echo toto',
       image='centos:latest',
       network_mode='bridge',
       mount_tmp_dir=False,
       do_xcom_push=True,
       task_id='docker_op_tester',
       dag=dag,
   )
   ```
   give
   ```
   [2021-07-27 19:39:27,176] {docker.py:246} INFO - Starting docker container 
from image centos:latest
   [2021-07-27 19:39:28,091] {docker.py:307} INFO - toto
   [2021-07-27 19:39:28,383] {taskinstance.py:1204} INFO - Marking task as 
SUCCESS. dag_id=docker_sample, task_id=docker_op_tester, 
execution_date=20210727T180000, start_date=20210727T193926, 
end_date=20210727T193928
   [2021-07-27 19:39:28,424] {taskinstance.py:1265} INFO - 0 downstream tasks 
scheduled from follow-on schedule check
   [2021-07-27 19:39:28,464] {local_task_job.py:149} INFO - Task exited with 
return code 0
   ```
   
   and in all case a XCOM 
   
   key : return_value
   value : toto
   
   
   


-- 
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