当我使用docker-compose up
运行docker-compose.yml文件时,它会输出:
ERROR: The Compose file is invalid because:
Service webserver has neither an image nor a build context specified. At least one must be provided.
在运行docker-compose up
之前,我使用成功的Dockerfile运行了docker build .
。到目前为止,我只尝试过退出、重新启动Docker,并使用docker system prune -a
删除Docker映像、容器、卷和网络
以下是Dockerfile:
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:
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
在
webserver.build
内缺少context
参数,该参数应指向Dockerfile
所在的相对路径:参考:https://docs.docker.com/compose/compose-file/#build
相关问题 更多 >
编程相关推荐