Setup Apache Airflow via docker on a linux based system

I am trying to setup apache airflow via docker and am facing an issue. I am using the following page – https://airflow.apache.org/docs/apache-airflow/2.0.1/start/docker.html

and when I run the following command – docker-compose up airflow-init

I am getting the following error

airflow-docker_redis_1 is up-to-date
Starting airflow-docker_airflow-init_1 ... done
Attaching to airflow-docker_airflow-init_1
airflow-init_1       | BACKEND=postgresql+psycopg2
airflow-init_1       | DB_HOST=postgres
airflow-init_1       | DB_PORT=5432
airflow-init_1       | 
airflow-init_1       | Traceback (most recent call last):
airflow-init_1       |   File "/home/airflow/.local/bin/airflow", line 5, in <module>
airflow-init_1       |     from airflow.__main__ import main
airflow-init_1       | ModuleNotFoundError: No module named 'airflow'
airflow-init_1       | Traceback (most recent call last):
airflow-init_1       |   File "/home/airflow/.local/bin/airflow", line 5, in <module>
airflow-init_1       |     from airflow.__main__ import main
airflow-init_1       | ModuleNotFoundError: No module named 'airflow'
airflow-init_1       | Traceback (most recent call last):
airflow-init_1       |   File "/home/airflow/.local/bin/airflow", line 5, in <module>
airflow-init_1       |     from airflow.__main__ import main
airflow-init_1       | ModuleNotFoundError: No module named 'airflow'
airflow-init_1       | Traceback (most recent call last):
airflow-init_1       |   File "/home/airflow/.local/bin/airflow", line 5, in <module>
airflow-init_1       |     from airflow.__main__ import main
airflow-init_1       | ModuleNotFoundError: No module named 'airflow'
airflow-init_1       | Traceback (most recent call last):
airflow-init_1       |   File "/home/airflow/.local/bin/airflow", line 5, in <module>
airflow-init_1       |     from airflow.__main__ import main
airflow-init_1       | ModuleNotFoundError: No module named 'airflow'
airflow-docker_airflow-init_1 exited with code 1

As you can see the docker-compose command has installed redis and postgres successfully. It can’t seem to find the airflow module. Here is a link to the yaml file for the docker-compose command – https://airflow.apache.org/docs/apache-airflow/2.0.1/docker-compose.yaml. Any idea what is going on? Is it because it is cannot find the airflow module inside the docker container?

Source: Docker Questions

LEAVE A COMMENT