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

标签 docker docker-compose

我想构建自定义 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

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

谢谢 !

最佳答案

当我从 Visual Studio 2019 中的 docker-compose 和 docker-compose-override 文件中删除一些应用程序时,我遇到了同样的问题。在再次运行 docker-compose 之前清理解决方案对我有用。

关于docker-compose 构建镜像或构建上下文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52283952/

相关文章:

docker - 使用 'Docker .NET Core Attach' 进行调试不再有效

c# - Visual Studio 2019不会在项目打开时提取所需的Docker镜像

curl - 如何在docker中使用文件系统创建卷?

amazon-web-services - 将 docker 镜像推送到亚马逊 ecs 存储库

Docker 容器在连接到 Internet 时未使用 NordLayer VPN

docker - Hyperledger Fabric Chaincode 安装失败 - 没有适用于 linux/arm64/v8 的匹配 list

c# - 在 ASP.NET Core 中使用 wkhtmltopdf、docker 将 HTML 转换为 PDF

mysql - Docker mysql连接错误

java - 在Windows上将mongoDB安装为docker镜像

apache - 无法让 SSL 在 Docker 容器中工作