docker compose 應用

docker-compose.yml 例範

services:
  service_name:
    build: 
      context: .
      dockerfile: Dockerfile
    ports:
      - "3000:3000"
    image: "image_name"

運行對應service

docker compose up <service_name>

運行時build image

docker compose up --build  <service_name>

不加server_name則運行全部service

背景運行

docker compose up -d <service_name>