我想构建自定义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-compose up --remove-orphans
来删除可能会缠绕的未使用的容器。