一、修改docker.service文件,添加监听端口
bash
vi /usr/lib/systemd/system/docker.service
bash
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
重启docker服务
bash
systemctl daemon-reload
systemctl start docker
二、idea的docker-compose启动配置(分四步)
-
Docker(Server)
-
docker-compose.yml
version : '3.9' services: ruoyi-gateway-test: #image: ruoyi/ruoyi-gateway:1.0.0 container_name: ruoyi-gateway-test build: context: ../ruoyi-gateway dockerfile: Dockerfile environment: # 时区上海 TZ: Asia/Shanghai volumes: # 配置文件 - /docker/zj-cloud/logs/ruoyi-gateway/:/ruoyi/ruoyi-gateway/logs/ ports: - "8889:8889" command: [ "--server.port=8889" ] privileged: true network_mode: "host" restart: always ruoyi-auth-test: #image: ruoyi/ruoyi-auth:1.0.0 container_name: ruoyi-auth-test build: context: ../ruoyi-auth dockerfile: Dockerfile ports: - "9299:9299" volumes: # 配置文件 - /docker/zj-cloud/logs/ruoyi-auth/:/ruoyi/ruoyi-auth/logs/ privileged: true network_mode: "host" restart: always ruoyi-modules-system-man-test: #image: ruoyi/ruoyi-modules-system-man:1.0.0 container_name: ruoyi-modules-system-man-test build: context: ../ruoyi-modules/ruoyi-system-man dockerfile: Dockerfile environment: # 时区上海 TZ: Asia/Shanghai volumes: # 配置文件 - /docker/zj-cloud/logs/ruoyi-modules-system-man/:/ruoyi/ruoyi-modules-system-man/logs ports: - "9399:9399" privileged: true network_mode: "host" restart: always ruoyi-modules-system-ops-test: #image: ruoyi/ruoyi-modules-system-ops:1.0.0 container_name: ruoyi-modules-system-ops-test build: context: ../ruoyi-modules/ruoyi-system-ops dockerfile: Dockerfile environment: # 时区上海 TZ: Asia/Shanghai volumes: # 配置文件 - /docker/zj-cloud/logs/ruoyi-modules-system-ops/:/ruoyi/ruoyi-modules-system-ops/logs ports: - "9499:9499" privileged: true network_mode: "host" restart: always ruoyi-modules-man-test: #image: ruoyi/ruoyi-modules-system-ops:1.0.0 container_name: ruoyi-modules-man-test build: context: ../ruoyi-modules/ruoyi-man dockerfile: Dockerfile environment: # 时区上海 TZ: Asia/Shanghai volumes: # 配置文件 - /docker/zj-cloud/logs/ruoyi-modules-man/:/ruoyi/ruoyi-modules-man/logs ports: - "9302:9302" privileged: true network_mode: "host" restart: always ruoyi-modules-ops-test: #image: ruoyi/ruoyi-modules-system-ops:1.0.0 container_name: ruoyi-modules-ops-test build: context: ../ruoyi-modules/ruoyi-ops dockerfile: Dockerfile environment: # 时区上海 TZ: Asia/Shanghai volumes: # 配置文件 - /docker/zj-cloud/logs/ruoyi-modules-ops/:/ruoyi/ruoyi-modules-ops/logs ports: - "9301:9301" privileged: true network_mode: "host" restart: always
-
命令,一定要勾选build,每次尽量重新构建镜像,同时如果需要单独启动/build某几个服务,就只需要输入对应服务名,逗号隔开,为空则时启动/build全部服务
-
启动之前可以执行maven 的clean和package命令【clean package -Dmaven.test.skip=true -U】