[英]Docker-compose starts a single container
我正在使用 docker-compose 并且我正在尝试在 docker 容器中运行快速应用程序和 postgres db。 我的问题是它只启动 postgres 图像,但 express 应用程序没有运行。
我究竟做错了什么?
我已经在我的 github 上发布了它: https://github.com/ayakymyshyn/docker-playground
looking at your docker-compose file and Dockerfile , i assume that your intention is that the web
service in the compose will actually run the image produced by the Dockerfile.
如果是这种情况,您需要修改 compose 文件并告诉它基于 Dockerfile 构建图像。
它应该看起来像
version: "3.7"
services:
web:
image: node
build: . # <--- this is the missing line
depends_on:
- db
ports:
- '3001:3001'
db:
image: postgres
environment:
POSTGRES_PASSWORD: 123123123
POSTGRES_USER: yakym
POSTGRES_DB: jwt
volumes:
- ./pgdata:/var/lib/postgresql/data
ports:
- '5433:5433'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.