fclesio / airflow-docker-operator-with-compose

How to use the DockerOperator in Airflow within Docker Compose?

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix docker daemon connection on mac

ahmetlekesiz opened this issue · comments

Problem:

urllib3.exceptions.ProtocolError: ('Connection aborted.', PermissionError(13, 'Permission denied'))

Fix:

  1. add docker-proxy to services
    docker-proxy:
    image: bobrik/socat
    command: "TCP4-LISTEN:2375,fork,reuseaddr UNIX-CONNECT:/var/run/docker.sock"
    ports:
      - "2376:2375"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
  1. change docker_url='unix://var/run/docker.sock' in the DockerOperator inside the DAG, into docker_url='tcp://docker-proxy:2375'

Thats all.

Detailed explanation: https://onedevblog.com/how-to-fix-a-permission-denied-when-using-dockeroperator-in-airflow/