简体   繁体   中英

Docker-compose: OCI runtime create failed, no such file or directory for entrypoint.sh

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM