Docker-compose:OCI运行时创建失败,entrypoint.sh文件或目录不存在

4

我在使用 entrypoint.sh 文件时,无法成功运行 docker-compose。尽管对该文件运行了 chmod +x 命令,但仍然收到此错误。您有什么想法,我做错了什么吗?

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

文件夹结构:

|--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

1
请使用完整路径而不是相对路径。 - Raman Sailopal
@Raman Saliopal - 谢谢!我将Web服务器入口点从./airflow/scripts/entrypoint.sh更改为/opt/airflow/scripts/entrypoint.sh,现在它可以工作了。 - Oliver Wills
这个回答解决了你的问题吗?Docker只能识别相对目录,而不能识别绝对目录 - tripleee
1个回答

0

首先,在airflow文件夹中给entrypoint.sh文件赋予权限,使用以下命令:

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

接下来的事情是在容器中使脚本可执行。添加以下代码行:

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

我遇到了同样的问题,并且通过这种方式解决了它。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接