一、修改docker.service文件,添加监听端口
vi /usr/lib/systemd/system/docker.service
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服务
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.0container_name: ruoyi-gateway-testbuild:context: ../ruoyi-gatewaydockerfile: Dockerfileenvironment:# 时区上海TZ: Asia/Shanghaivolumes:# 配置文件- /docker/zj-cloud/logs/ruoyi-gateway/:/ruoyi/ruoyi-gateway/logs/ports:- "8889:8889"command: ["--server.port=8889"]privileged: truenetwork_mode: "host"restart: alwaysruoyi-auth-test:#image: ruoyi/ruoyi-auth:1.0.0container_name: ruoyi-auth-testbuild:context: ../ruoyi-authdockerfile: Dockerfileports:- "9299:9299"volumes:# 配置文件- /docker/zj-cloud/logs/ruoyi-auth/:/ruoyi/ruoyi-auth/logs/privileged: truenetwork_mode: "host"restart: alwaysruoyi-modules-system-man-test:#image: ruoyi/ruoyi-modules-system-man:1.0.0container_name: ruoyi-modules-system-man-testbuild:context: ../ruoyi-modules/ruoyi-system-mandockerfile: Dockerfileenvironment:# 时区上海TZ: Asia/Shanghaivolumes:# 配置文件- /docker/zj-cloud/logs/ruoyi-modules-system-man/:/ruoyi/ruoyi-modules-system-man/logsports:- "9399:9399"privileged: truenetwork_mode: "host"restart: alwaysruoyi-modules-system-ops-test:#image: ruoyi/ruoyi-modules-system-ops:1.0.0container_name: ruoyi-modules-system-ops-testbuild:context: ../ruoyi-modules/ruoyi-system-opsdockerfile: Dockerfileenvironment:# 时区上海TZ: Asia/Shanghaivolumes:# 配置文件- /docker/zj-cloud/logs/ruoyi-modules-system-ops/:/ruoyi/ruoyi-modules-system-ops/logsports:- "9499:9499"privileged: truenetwork_mode: "host"restart: alwaysruoyi-modules-man-test:#image: ruoyi/ruoyi-modules-system-ops:1.0.0container_name: ruoyi-modules-man-testbuild:context: ../ruoyi-modules/ruoyi-mandockerfile: Dockerfileenvironment:# 时区上海TZ: Asia/Shanghaivolumes:# 配置文件- /docker/zj-cloud/logs/ruoyi-modules-man/:/ruoyi/ruoyi-modules-man/logsports:- "9302:9302"privileged: truenetwork_mode: "host"restart: alwaysruoyi-modules-ops-test:#image: ruoyi/ruoyi-modules-system-ops:1.0.0container_name: ruoyi-modules-ops-testbuild:context: ../ruoyi-modules/ruoyi-opsdockerfile: Dockerfileenvironment:# 时区上海TZ: Asia/Shanghaivolumes:# 配置文件- /docker/zj-cloud/logs/ruoyi-modules-ops/:/ruoyi/ruoyi-modules-ops/logsports:- "9301:9301"privileged: truenetwork_mode: "host"restart: always
-
命令,一定要勾选build,每次尽量重新构建镜像,同时如果需要单独启动/build某几个服务,就只需要输入对应服务名,逗号隔开,为空则时启动/build全部服务
-
启动之前可以执行maven 的clean和package命令【clean package -Dmaven.test.skip=true -U】