4

I am struggling to run docker-compose when using an entrypoint.sh file. I am receiving this error even though I have run chmod +x on the file. Any idea what I am doing wrong?

ERROR: for airflow_webserver_1  Cannot start service webserver: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"./airflow/scripts/entrypoint.sh\": stat ./airflow/scripts/entrypoint.sh: no such file or directory": unknown

Folder structure:

|--airflow
   |--dags
   |--logs
   |--scripts
      |--entrypoint.sh
|--.env
|--docker-compose.yml

entrypoint.sh:

#!/bin/sh
airflow db init
airflow webserver

docker-compose.yml

version: '3.0'
services:
  webserver:
    image: apache/airflow:1.10.14
    volumes:
      - ./airflow/dags:/opt/airflow/dags
      - ./airflow/logs:/opt/airflow/logs
      - ./airflow/scripts:/opt/airflow/scripts
    ports:
      - "8080:8080"
    deploy:
      restart_policy:
        condition: on-failure
        max_attempts: 3
    env_file:
      .env
    entrypoint: ./airflow/scripts/entrypoint.sh
  scheduler:
    image: apache/airflow:1.10.14
    command: ["scheduler"]
    volumes:
      - ./airflow/dags:/opt/airflow/dags
      - ./airflow/logs:/opt/airflow/logs
    deploy:
      restart_policy:
        condition: on-failure
        max_attempts: 3
    env_file:
      .env
Oliver Wills
  • 49
  • 1
  • 2
  • 1
    Use the full path and not relative ones. – Raman Sailopal Jan 10 '21 at 18:22
  • @Raman Saliopal - Thank you! I changed the webserver entrypoint from ./airflow/scripts/entrypoint.sh to /opt/airflow/scripts/entrypoint.sh and it now works. – Oliver Wills Jan 13 '21 at 14:03
  • Does this answer your question? [Docker only recognizes relative directories, not absolute](https://stackoverflow.com/questions/69761069/docker-only-recognizes-relative-directories-not-absolute) – tripleee Jun 25 '22 at 10:43

1 Answers1

0

First, give permission to the entrypoint.sh by using the following command in the airflow folder in which the entrypoint file is located

chmod +x ./file-if-any/entrypoint.sh

Then the next thing is to make the script executable in the container. Add the line of code below

RUN chmod +x ./file-if-any/entrypoint.sh

I got the same problem and was able to solve it with this.

Amaboh
  • 1
  • 2