简体   繁体   English

docker-compose exec: \“webserver\”: $PATH 中找不到可执行文件

[英]docker-compose exec: \“webserver\”: executable file not found in $PATH

When I run my docker-compose.yml file using docker-compose up , it outputs:当我使用docker-compose up运行我的 docker-compose.yml 文件时,它输出:

Removing airflow_webserver_1
Starting airflow_postgres_1 ... done
Recreating bfec6e557af5_airflow_webserver_1 ... error

ERROR: for bfec6e557af5_airflow_webserver_1  Cannot start service webserver: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"webserver\": executable file not found in $PATH": unknown

ERROR: for webserver  Cannot start service webserver: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"webserver\": executable file not found in $PATH": unknown
ERROR: Encountered errors while bringing up the project.

Before running docker-compose up I ran docker build.在运行docker-compose up之前,我运行了docker build. using a Dockerfile that was successful.使用成功的 Dockerfile。 So far i've only tried quitting, restarting Docker, and using docker system prune -a to remove docker images, containers, volumes, and networks.到目前为止,我只尝试过退出,重新启动 Docker,并使用docker system prune -a删除 docker 图像、容器、卷和网络。

Here's the Dockerfile:这是 Dockerfile:

FROM python:3
WORKDIR /usr/local/airflow/
COPY requirements.txt ./
RUN pip install --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt
COPY . .

Here's the docker-compose.yml file:这是 docker-compose.yml 文件:

version: '3.7'
services:
    postgres:
        image: postgres:9.6
        environment:
            - POSTGRES_USER=airflow
            - POSTGRES_PASSWORD=airflow
            - POSTGRES_DB=airflow
        logging:
            options:
                max-size: 10m
                max-file: "3"

    webserver:
        # image: puckel/docker-airflow:1.10.9
        image: puckel/docker-airflow:latest
        restart: always
        depends_on:
            - postgres
        environment:
            - LOAD_EX=n
            - EXECUTOR=Local
        logging:
            options:
                max-size: 10m
                max-file: "3"
        volumes:
            - ./dags:/usr/local/airflow/dags
            # - ./plugins:/usr/local/airflow/plugins
            - ./plugins/:/usr/local/airflow/plugins
            - ./requirements.txt:/requirements.txt
        ports:
            - "8080:8080"
        command: webserver
        healthcheck:
            test: ["CMD-SHELL", "[ -f /usr/local/airflow/airflow-webserver.pid ]"]
            interval: 30s
            timeout: 30s
            retries: 3

        build:
            context .
            args:
                PYTHON_DEPS: "boto3==1.12.41, notebook==6.0.3, numpy==1.18.1, pandas==0.25.3, psycopg2==2.8.4"
                AIRFLOW_DEPS: "aws, postgres"

Here's the requirement.txt file:这是 requirements.txt 文件:

boto3==1.12.41
notebook==6.0.3
numpy==1.18.1
pandas==0.25.3
psycopg2==2.8.4

I have a few questions:我有几个问题:

  1. Why you have a healthcheck and command params in you docker-compose.yml file?为什么healthcheck文件中有docker-compose.yml检查和command参数? Are you sure you need them there and not in Dockerfile file?你确定你需要它们而不是Dockerfile文件吗?
  2. You building image with arguments PYTHON_DEPS and AIRFLOW_DEPS , where you are using them?您使用 arguments PYTHON_DEPSAIRFLOW_DEPS构建图像,您在哪里使用它们? Remember you are using FROM python:3 system where only python installed.请记住,您使用的是FROM python:3系统,其中仅安装了 python。
  3. image: puckel/docker-airflow:latest -- are you maintainer of this image? image: puckel/docker-airflow:latest -- 你是这个图片的维护者吗?
  4. Can you explain WHAT you want to do in Dockerfile , becouse you just copying your filed to only python installed image.你能解释一下你想在Dockerfile做什么,因为你只是将你的文件复制到 python 安装的图像。

As I understand you exstend some functionality of puckel/docker-airflow by adding your code, then you need:据我了解,您通过添加代码来puckel/docker-airflow airflow 的一些功能,那么您需要:

  1. Use from FROM puckel/docker-airflow:latest in your Dockerfile使用FROM puckel/docker-airflow:latest在你的Dockerfile
  2. Set you tag on to build docker build -t my-airflow.设置您的标签以构建docker build -t my-airflow.
  3. Change image value on docker-compose.yml to image: my-airflowdocker-compose.yml上的image值更改为image: my-airflow airflow
  4. Run it.运行。 Then everything make sense.那么一切都说得通了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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