docker-compose构建映像或构建上下文

问题描述 投票:1回答:2

我想构建自定义Dockerfile,但我有这样的消息: --> Starting build app ERROR: The Compose file is invalid because: Service app has neither an image nor a build context specified. At least one must be provided.

我不明白为什么这个名字是app。你可以看到我的docker-compose.yml文件:

version: "3"

services:
  webapp-react:
    build:
      context: ./docker/nodejs
      dockerfile: Dockerfile
    image: webapp/react
    container_name: webapp_react
    user: ${UID}:${GID}
    environment:
      - NODE_ENV=build

  webapp-nginx:
    build:
      context: ./docker/nginx
      dockerfile: Dockerfile
    image: webapp/nginx
    container_name: webapp_nginx
    environment:
      - VIRTUAL_HOST=${SITE_URL}
      - VIRTUAL_PORT=8080
      - VIRTUAL_NETWORK=nginx-proxy
      - LETSENCRYPT_HOST=${SITE_URL}
      - LETSENCRYPT_EMAIL=${MAILER_DEFAUT_SENDER_ADDRESS}
    ports:
      - "8181:80"
    volumes:
      - ./app/build:/www-data/

networks:
  default:
    external:
      name: nginx-proxy

有谁知道我在哪里犯了错误?

谢谢 !

docker docker-compose
2个回答
0
投票

我在文档中找不到任何提示,但它可能是服务名称中的-


0
投票

尝试运行docker-compose up --remove-orphans来删除可能会缠绕的未使用的容器。

© www.soinside.com 2019 - 2024. All rights reserved.