From f770e5f5b2ed1a91bd34b4373b52e455d8bc65ee Mon Sep 17 00:00:00 2001 From: Amy Wieliczka Date: Thu, 28 Sep 2023 16:16:48 -0700 Subject: [PATCH] mount docker.sock & set perms; required for DockerOperator usage :socks: --- docker/.env | 3 ++- docker/docker-compose-local.yml | 1 + docker/script/run-startup.sh | 6 +++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docker/.env b/docker/.env index adf129dc7..a6b312cf0 100644 --- a/docker/.env +++ b/docker/.env @@ -3,4 +3,5 @@ DAGS_HOME="" PLUGINS_HOME="" REQS_HOME="" STARTUP_HOME="" -RIKOLTI_DATA_HOME="" \ No newline at end of file +RIKOLTI_DATA_HOME="" +DOCKER_SOCKET="" \ No newline at end of file diff --git a/docker/docker-compose-local.yml b/docker/docker-compose-local.yml index 1080f91e4..eb55a8b52 100644 --- a/docker/docker-compose-local.yml +++ b/docker/docker-compose-local.yml @@ -31,6 +31,7 @@ services: - "${REQS_HOME}:/usr/local/airflow/requirements" - "${STARTUP_HOME}:/usr/local/airflow/startup" - "${RIKOLTI_DATA_HOME}:/usr/local/airflow/rikolti_data" + - "${DOCKER_SOCKET}:/var/run/docker.sock" ports: - "8080:8080" command: local-runner diff --git a/docker/script/run-startup.sh b/docker/script/run-startup.sh index eb1e8013f..083dd0546 100644 --- a/docker/script/run-startup.sh +++ b/docker/script/run-startup.sh @@ -1,4 +1,8 @@ #!/usr/bin/env bash source "$AIRFLOW_HOME/startup/startup.sh" -declare -p | grep -v '^declare \-[aAilnrtux]*r ' > stored_env \ No newline at end of file +declare -p | grep -v '^declare \-[aAilnrtux]*r ' > stored_env + +# allows the airflow user on the airflow docker container to access +# the host's docker.sock. This is needed for the DockerOperator to work. +sudo chmod 666 /var/run/docker.sock \ No newline at end of file