Docker Compose 管理springboot项目

67 阅读1分钟

1. 项目目录创建compose.yaml

services:
  server:
    build:
      context: .
    ports:
      - 8080:8080

左边端口是访问端口,右边端口,程序配置的端口

2. 后台方式启动项目

docker-compose up -d 

image.png

3. 停止后台运行的服务

docker-compose down

image.png