簡體   English   中英

Docker-compose 啟動單個容器

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM