当我使用
在运行
以下是Dockerfile:
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.
在运行
docker-compose up
之前,我使用成功的Dockerfile运行了docker build .
。到目前为止,我只尝试过退出、重新启动Docker,并使用docker system prune -a
来删除Docker映像、容器、卷和网络。以下是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 . .
这是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"
以下是 requirement.txt 文件:
boto3==1.12.41
notebook==6.0.3
numpy==1.18.1
pandas==0.25.3
psycopg2==2.8.4
CMD
?docker-compose.yml
有一个覆盖项command: webserver
,那个命令会被安装在哪里? - David Mazewebserver
的命令可以在容器内运行?您需要在 Dockerfile 中使用CMD
或ENTRYPOINT
,或在 docker-compose 中使用command
来定义容器启动时应执行的内容。 - Wander3rFROM
行。 - Klaus D.pip install --upgrade pip && \ pip install --no-cache-dir -r requirements.txt
。我对 Docker 很陌生,不确定command: webserver
安装在哪里。 - MarshallmCMD bash script/entrypoint.sh
,但是仍然出现了相同的错误。 - Marshallm