Closed cmeans closed 3 months ago
Found a 'work-around'
Ran:
astro dev object export --compose
Added volume entry:
- /var/run/docker.sock:/var/run/docker.sock:z
to both scheduler
and triggerer
.
Then:
docker compose up -d
DAG ran just fine:
*** Found local files:
*** * /usr/local/airflow/logs/dag_id=docker_sample/run_id=scheduled__2024-04-07T19:10:00+00:00/task_id=docker_op_tester/attempt=1.log
[2024-04-07, 19:23:34 UTC] {taskinstance.py:1979} INFO - Dependencies all met for dep_context=non-requeueable deps ti=<TaskInstance: docker_sample.docker_op_tester scheduled__2024-04-07T19:10:00+00:00 [queued]>
[2024-04-07, 19:23:34 UTC] {taskinstance.py:1979} INFO - Dependencies all met for dep_context=requeueable deps ti=<TaskInstance: docker_sample.docker_op_tester scheduled__2024-04-07T19:10:00+00:00 [queued]>
[2024-04-07, 19:23:34 UTC] {taskinstance.py:2193} INFO - Starting attempt 1 of 3
[2024-04-07, 19:23:34 UTC] {taskinstance.py:2217} INFO - Executing <Task(DockerOperator): docker_op_tester> on 2024-04-07 19:10:00+00:00
[2024-04-07, 19:23:34 UTC] {standard_task_runner.py:60} INFO - Started process 200 to run task
[2024-04-07, 19:23:34 UTC] {standard_task_runner.py:87} INFO - Running: ['airflow', 'tasks', 'run', 'docker_sample', 'docker_op_tester', 'scheduled__2024-04-07T19:10:00+00:00', '--job-id', '4', '--raw', '--subdir', 'DAGS_FOLDER/docker_operator_dag.py', '--cfg-path', '/tmp/tmpehzi7c_b']
[2024-04-07, 19:23:34 UTC] {standard_task_runner.py:88} INFO - Job 4: Subtask docker_op_tester
[2024-04-07, 19:23:34 UTC] {task_command.py:423} INFO - Running <TaskInstance: docker_sample.docker_op_tester scheduled__2024-04-07T19:10:00+00:00 [running]> on host 9b01d8238522
[2024-04-07, 19:23:34 UTC] {taskinstance.py:2513} INFO - Exporting env vars: AIRFLOW_CTX_DAG_OWNER='airflow' AIRFLOW_CTX_DAG_ID='docker_sample' AIRFLOW_CTX_TASK_ID='docker_op_tester' AIRFLOW_CTX_EXECUTION_DATE='2024-04-07T19:10:00+00:00' AIRFLOW_CTX_TRY_NUMBER='1' AIRFLOW_CTX_DAG_RUN_ID='scheduled__2024-04-07T19:10:00+00:00'
[2024-04-07, 19:23:34 UTC] {docker.py:486} INFO - Pulling docker image centos:latest
[2024-04-07, 19:23:35 UTC] {docker.py:500} INFO - latest: Pulling from library/centos
[2024-04-07, 19:23:35 UTC] {docker.py:500} INFO - 52f9ef134af7: Pulling fs layer
[2024-04-07, 19:23:36 UTC] {docker.py:500} INFO - 52f9ef134af7: Downloading
[2024-04-07, 19:23:38 UTC] {docker.py:500} INFO - 52f9ef134af7: Verifying Checksum
[2024-04-07, 19:23:38 UTC] {docker.py:500} INFO - 52f9ef134af7: Download complete
[2024-04-07, 19:23:38 UTC] {docker.py:500} INFO - 52f9ef134af7: Extracting
[2024-04-07, 19:23:40 UTC] {docker.py:500} INFO - 52f9ef134af7: Pull complete
[2024-04-07, 19:23:40 UTC] {docker.py:495} INFO - Digest: sha256:a27fd8080b517143cbbbab9dfb7c8571c40d67d534bbdee55bd6c473f432b177
[2024-04-07, 19:23:40 UTC] {docker.py:495} INFO - Status: Downloaded newer image for centos:latest
[2024-04-07, 19:23:40 UTC] {docker.py:359} INFO - Starting docker container from image centos:latest
[2024-04-07, 19:23:41 UTC] {docker.py:367} 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
[2024-04-07, 19:24:11 UTC] {taskinstance.py:1149} INFO - Marking task as SUCCESS. dag_id=docker_sample, task_id=docker_op_tester, execution_date=20240407T191000, start_date=20240407T192334, end_date=20240407T192411
[2024-04-07, 19:24:11 UTC] {local_task_job_runner.py:234} INFO - Task exited with return code 0
[2024-04-07, 19:24:11 UTC] {taskinstance.py:3312} INFO - 1 downstream tasks scheduled from follow-on schedule check
How can I get this to work using the standard astro dev start
command?
You can use custom compose file with astro dev start
by doing astro dev start --compose-file <custom-file>
You can use custom compose file with
astro dev start
by doingastro dev start --compose-file <custom-file>
Great, thanks @sunkickr . So there are no better solutions to this than my approach of a custom compose file?
@cmeans yes for now this is the only solution. astro dev start --compose-file <custom-file>
is designed to give user the flexibility to do things like this
Describe the bug
DockerOperator is unable to reach the local "unix" socket.
What CLI Version did you experience this bug? Astro CLI Version: 1.25.0
This CLI bug is related to which Astronomer Platform?
What Operating System is the above CLI installed on? MacBook Pro (M3) Sonoma 14.4.1 (23E224)
🪜 Steps To Reproduce
Run a DAG that consumes DockerOperator.