{"id":21946,"date":"2025-04-19T05:11:45","date_gmt":"2025-04-18T21:11:45","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/21946.html"},"modified":"2025-04-19T05:11:45","modified_gmt":"2025-04-18T21:11:45","slug":"%e5%9c%a8centos-7%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%bd%bf%e7%94%a8docker%e9%83%a8%e7%bd%b2%e8%8b%a5%e4%be%9druoyi%e5%89%8d%e5%90%8e%e7%ab%af%e5%88%86%e7%a6%bb%e9%a1%b9%e7%9b%ae%e6%8c%87%e5%8d%97","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/21946.html","title":{"rendered":"\u5728CentOS 7\u670d\u52a1\u5668\u4f7f\u7528Docker\u90e8\u7f72\u82e5\u4f9d(RuoYi)\u524d\u540e\u7aef\u5206\u79bb\u9879\u76ee\u6307\u5357"},"content":{"rendered":"<h4 id=\"%E4%B8%80%E3%80%81%E5%89%8D%E8%A8%80\">\u4e00\u3001\u524d\u8a00<\/h4>\n<p>\u82e5\u4f9d(RuoYi)\u662f\u4e00\u6b3e\u57fa\u4e8eSpringBoot&#043;Vue\u7684\u524d\u540e\u7aef\u5206\u79bb\u6743\u9650\u7ba1\u7406\u7cfb\u7edf&#xff0c;\u91c7\u7528Docker\u90e8\u7f72\u53ef\u4ee5\u7b80\u5316\u73af\u5883\u914d\u7f6e\u3001\u63d0\u5347\u90e8\u7f72\u6548\u7387\u3002\u672c\u6587\u5c06\u901a\u8fc7\u8be6\u7ec6\u6b65\u9aa4\u6f14\u793a\u5982\u4f55\u5728CentOS 7\u670d\u52a1\u5668\u4e0a\u4f7f\u7528Docker\u5bb9\u5668\u5316\u90e8\u7f72\u82e5\u4f9d\u524d\u540e\u7aef\u5206\u79bb\u9879\u76ee\u3002<\/p>\n<h4 id=\"%E4%BA%8C%E3%80%81%E7%8E%AF%E5%A2%83%E5%87%86%E5%A4%87\">\u4e8c\u3001\u73af\u5883\u51c6\u5907<\/h4>\n<h5 id=\"1.%20%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%85%8D%E7%BD%AE\">1. \u670d\u52a1\u5668\u914d\u7f6e<\/h5>\n<ul>\n<li>\n<p>\u64cd\u4f5c\u7cfb\u7edf&#xff1a;CentOS 7.6&#043;<\/p>\n<\/li>\n<li>\n<p>\u5185\u5b58&#xff1a;\u5efa\u8bae4GB&#043;<\/p>\n<\/li>\n<li>\n<p>\u786c\u76d8&#xff1a;20GB&#043;\u53ef\u7528\u7a7a\u95f4<\/p>\n<\/li>\n<li>\n<p>\u5f00\u653e\u7aef\u53e3&#xff1a;80\u30018080\u30013306\u30016379<\/p>\n<\/li>\n<\/ul>\n<h5>2.\u5b89\u88c5Docker\u73af\u5883<\/h5>\n<p># \u5b89\u88c5\u4f9d\u8d56<br \/>\nsudo yum install -y yum-utils<br \/>\n# \u6dfb\u52a0Docker\u6e90<br \/>\nsudo yum-config-manager &#8211;add-repo https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/centos\/docker-ce.repo<\/p>\n<p>sudo sed -i &#039;s&#043;download.docker.com&#043;mirrors.aliyun.com\/docker-ce&#043;&#039; \/etc\/yum.repos.d\/docker-ce.repo<br \/>\n# \u5b89\u88c5Docker<br \/>\nsudo yum install -y docker-ce docker-ce-cli containerd.io<br \/>\n# \u542f\u52a8\u5e76\u8bbe\u7f6e\u5f00\u673a\u81ea\u542f<br \/>\nsudo systemctl enable &#8211;now docker <\/p>\n<h5>\u00a03. \u5b89\u88c5Docker Compose<\/h5>\n<p># \u4e0b\u8f7dDocker Compose<br \/>\nsudo curl -L &#034;https:\/\/mirror.aliyun.com\/docker-toolbox\/linux\/compose\/2.26.1\/docker-compose-linux-$(uname -m)&#034; -o \/usr\/local\/bin\/docker-compose<\/p>\n<p># \u8d4b\u4e88\u6267\u884c\u6743\u9650<br \/>\nsudo chmod &#043;x \/usr\/local\/bin\/docker-compose<\/p>\n<p># \u9a8c\u8bc1\u5b89\u88c5<br \/>\ndocker-compose &#8211;version <\/p>\n<h5 id=\"3.%20%E5%BC%80%E6%94%BE%E9%98%B2%E7%81%AB%E5%A2%99%E7%AB%AF%E5%8F%A3\" style=\"background-color:transparent\">4. \u5f00\u653e\u9632\u706b\u5899\u7aef\u53e3<\/h5>\n<p> # \u963f\u91cc\u4e91\u63a7\u5236\u53f0\u9700\u989d\u5916\u5f00\u653e\u7aef\u53e3&#xff1a;80, 443, 3306, 6379 <\/p>\n<h4 id=\"%E4%B8%89%E3%80%81%E5%87%86%E5%A4%87%E9%A1%B9%E7%9B%AE%E7%9B%AE%E5%BD%95%E7%BB%93%E6%9E%84%C2%A0\">\u4e09\u3001\u51c6\u5907\u9879\u76ee\u76ee\u5f55\u7ed3\u6784\u00a0<\/h4>\n<h5 id=\"1.%20%E5%88%9B%E5%BB%BA%E9%A1%B9%E7%9B%AE%E6%A0%B9%E7%9B%AE%E5%BD%95\">1. \u521b\u5efa\u9879\u76ee\u6839\u76ee\u5f55<\/h5>\n<p>mkdir -p \/opt\/ruoyi\/{mysql,redis,backend,frontend,nginx}<br \/>\ncd \/opt\/ruoyi <\/p>\n<h5 id=\"%C2%A02.%20%E7%9B%AE%E5%BD%95%E7%BB%93%E6%9E%84%E8%AF%B4%E6%98%8E\">\u00a02. \u76ee\u5f55\u7ed3\u6784\u8bf4\u660e<\/h5>\n<p>\/opt\/ruoyi<br \/>\n\u251c\u2500\u2500 docker-compose.yml          # \u4e3b\u7f16\u6392\u6587\u4ef6<br \/>\n\u251c\u2500\u2500 mysql<br \/>\n\u2502   \u251c\u2500\u2500 data                   # \u6570\u636e\u5e93\u6301\u4e45\u5316\u6570\u636e<br \/>\n\u2502   \u2514\u2500\u2500 init                   # \u521d\u59cb\u5316SQL\u811a\u672c<br \/>\n\u251c\u2500\u2500 redis<br \/>\n\u2502   \u2514\u2500\u2500 data                   # Redis\u6301\u4e45\u5316\u6570\u636e<br \/>\n\u251c\u2500\u2500 backend<br \/>\n\u2502   \u251c\u2500\u2500 Dockerfile             # \u540e\u7aef\u955c\u50cf\u6784\u5efa\u6587\u4ef6<br \/>\n\u2502   \u251c\u2500\u2500 ruoyi-admin.jar        # \u540e\u7aefJAR\u5305&#xff08;\u9700\u81ea\u884c\u653e\u5165&#xff09;<br \/>\n\u2502   \u2514\u2500\u2500 application.yml        # \u540e\u7aef\u914d\u7f6e\u6587\u4ef6&#xff08;\u9700\u4fee\u6539&#xff09;<br \/>\n\u2514\u2500\u2500 frontend<br \/>\n    \u251c\u2500\u2500 Dockerfile             # \u524d\u7aef\u955c\u50cf\u6784\u5efa\u6587\u4ef6<br \/>\n    \u251c\u2500\u2500 dist                   # \u524d\u7aef\u7f16\u8bd1\u540e\u7684\u9759\u6001\u6587\u4ef6&#xff08;\u9700\u81ea\u884c\u653e\u5165&#xff09;<br \/>\n    \u2514\u2500\u2500 nginx.conf             # \u524d\u7aefNginx\u914d\u7f6e <\/p>\n<h5 id=\"%C2%A0%E4%B8%89%E3%80%81%E9%83%A8%E7%BD%B2%20MySQL%20%E5%92%8C%20Redis\" style=\"background-color:transparent\">\u00a0\u4e09\u3001\u90e8\u7f72 MySQL \u548c Redis<\/h5>\n<h5 id=\"1.%20%E7%BC%96%E5%86%99%C2%A0docker-compose.yml\">1. \u7f16\u5199\u00a0docker-compose.yml<\/h5>\n<p>version: &#039;3.8&#039;<br \/>\nservices:<br \/>\n  mysql:<br \/>\n    image: mysql:8.0<br \/>\n    container_name: ruoyi-mysql<br \/>\n    command:<br \/>\n      &#8211;character-set-server&#061;utf8mb4<br \/>\n      &#8211;collation-server&#061;utf8mb4_unicode_ci<br \/>\n      &#8211;default-authentication-plugin&#061;mysql_native_password<br \/>\n    environment:<br \/>\n      MYSQL_ROOT_PASSWORD: root&#064;123    # \u81ea\u5b9a\u4e49root\u5bc6\u7801<br \/>\n      MYSQL_DATABASE: ry-cloud         # \u6570\u636e\u5e93\u540d\u9700\u4e0eRuoYi\u914d\u7f6e\u4e00\u81f4<br \/>\n      MYSQL_USER: root<br \/>\n      MYSQL_PASSWORD: root&#064;123<br \/>\n      # \u65b0\u589e\u5b57\u7b26\u96c6\u73af\u5883\u53d8\u91cf<br \/>\n      MYSQL_CHARACTER_SET_SERVER: utf8mb4<br \/>\n      MYSQL_COLLATION_SERVER: utf8mb4_unicode_ci<br \/>\n    ports:<br \/>\n      &#8211; &#034;3306:3306&#034;<br \/>\n    volumes:<br \/>\n      &#8211; .\/mysql\/data:\/var\/lib\/mysql          # \u6570\u636e\u6301\u4e45\u5316<br \/>\n      &#8211; .\/mysql\/init:\/docker-entrypoint-initdb.d  # \u521d\u59cb\u5316SQL<br \/>\n    networks:<br \/>\n      &#8211; ruoyi-net<\/p>\n<p>  redis:<br \/>\n    image: redis:6.2<br \/>\n    container_name: ruoyi-redis<br \/>\n    ports:<br \/>\n      &#8211; &#034;6379:6379&#034;<br \/>\n    volumes:<br \/>\n      &#8211; .\/redis\/data:\/data<br \/>\n    command: redis-server &#8211;requirepass redis&#064;123  # Redis\u5bc6\u7801\u9700\u4e0eRuoYi\u914d\u7f6e\u4e00\u81f4<br \/>\n    networks:<br \/>\n      &#8211; ruoyi-net<\/p>\n<p>networks:<br \/>\n  ruoyi-net:  # \u81ea\u5b9a\u4e49\u7f51\u7edc&#xff0c;\u786e\u4fdd\u5bb9\u5668\u95f4\u901a\u8fc7\u670d\u52a1\u540d\u901a\u4fe1 <\/p>\n<h5 id=\"2.%20%E5%AF%BC%E5%85%A5%20RuoYi%20%E5%88%9D%E5%A7%8B%E5%8C%96SQL\">2. \u5bfc\u5165 RuoYi \u521d\u59cb\u5316SQL<\/h5>\n<p># \u5c06 RuoYi \u7684 SQL \u6587\u4ef6&#xff08;\u5982 ry_2023xxxx.sql \u548c quartz.sql&#xff09;\u653e\u5165\u76ee\u5f55<br \/>\ncp ry_2023xxxx.sql \/opt\/ruoyi\/mysql\/init\/<br \/>\ncp quartz.sql \/opt\/ruoyi\/mysql\/init\/ <\/p>\n<h4 id=\"%C2%A0%E5%9B%9B%E3%80%81%E9%83%A8%E7%BD%B2%E5%90%8E%E7%AB%AF%E6%9C%8D%E5%8A%A1%EF%BC%88Spring%20Boot%EF%BC%89\">\u00a0\u56db\u3001\u90e8\u7f72\u540e\u7aef\u670d\u52a1&#xff08;Spring Boot&#xff09;<\/h4>\n<h5 id=\"1.%20%E5%87%86%E5%A4%87%E5%90%8E%E7%AB%AF%E6%96%87%E4%BB%B6\">1. \u51c6\u5907\u540e\u7aef\u6587\u4ef6<\/h5>\n<ul>\n<li>\n<p>\u5c06\u7f16\u8bd1\u597d\u7684\u00a0ruoyi-admin.jar\u00a0\u653e\u5165\u00a0\/opt\/ruoyi\/backend<\/p>\n<\/li>\n<li>\n<p>\u521b\u5efa\u00a0backend\/Dockerfile&#xff1a;<\/p>\n<\/li>\n<li> FROM openjdk:17-jdk-slim<br \/>\n# \u5173\u952e&#xff1a;\u5b89\u88c5\u5b57\u4f53\u5e93&#xff08;Debian \u7cfb\u547d\u4ee4&#xff09;<br \/>\nRUN apt-get update \\\\<br \/>\n    &amp;&amp; apt-get install -y &#8211;no-install-recommends \\\\<br \/>\n        libfreetype6 \\\\<br \/>\n        fontconfig \\\\<br \/>\n    &amp;&amp; rm -rf \/var\/lib\/apt\/lists\/*<br \/>\nWORKDIR \/app<br \/>\nCOPY dafu-admin.jar .\/app.jar<br \/>\nEXPOSE 8080<br \/>\nENTRYPOINT [&#034;java&#034;, &#034;-jar&#034;, &#034;app.jar&#034;] <\/p>\n<h5 id=\"%F0%9F%93%8A%20%E9%95%9C%E5%83%8F%E5%AF%B9%E6%AF%94%E8%A1%A8%C2%A0%C2%A0\">&#x1f4ca; \u955c\u50cf\u5bf9\u6bd4\u8868\u00a0\u00a0<\/h5>\n<\/li>\n<li>\u8bbe\u7f6e\u5b57\u4f53\u5e93\u4f5c\u7528\u4e8e\u82e5\u4f9d\u6846\u67b6\u8d26\u53f7-\u9a8c\u8bc1\u7801<\/li>\n<li>\n<table>\n<tr>\u955c\u50cf\u540d\u79f0\u4f53\u79ef\u5185\u7f6e\u5b57\u4f53\u662f\u5426\u9700\u8981\u989d\u5916\u5b89\u88c5\u7279\u70b9<\/tr>\n<tbody>\n<tr>\n<td>eclipse-temurin:17-jre-jammy<\/td>\n<td>210MB<\/td>\n<td>\u2705<\/td>\n<td>\u274c<\/td>\n<td>\u751f\u4ea7\u9996\u9009<\/td>\n<\/tr>\n<tr>\n<td>amazoncorretto:17-al2-full<\/td>\n<td>400MB<\/td>\n<td>\u2705<\/td>\n<td>\u274c<\/td>\n<td>AWS \u73af\u5883\u4f18\u5316<\/td>\n<\/tr>\n<tr>\n<td>azul\/zulu-openjdk:17<\/td>\n<td>450MB<\/td>\n<td>\u2705<\/td>\n<td>\u274c<\/td>\n<td>\u591a\u67b6\u6784\u652f\u6301<\/td>\n<\/tr>\n<tr>\n<td>openjdk:17-jdk-slim<\/td>\n<td>300MB<\/td>\n<td>\u274c<\/td>\n<td>\u2705<\/td>\n<td>\u9700\u624b\u52a8\u5b89\u88c5\u4f9d\u8d56<\/td>\n<\/tr>\n<tr>\n<td>eclipse-temurin:17-jre-alpine<\/td>\n<td>80MB<\/td>\n<td>\u274c<\/td>\n<td>\u2705&#xff08;\u5c11\u91cf&#xff09;<\/td>\n<td>\u6781\u7b80\u4f46\u517c\u5bb9\u6027\u7565\u4f4e<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<\/ul>\n<h5 style=\"background-color:transparent\">\u00a02. \u4fee\u6539\u540e\u7aef\u914d\u7f6e<\/h5>\n<p>\u00a0 \u00a0\u7f16\u8f91application.yml\/application-druid.yml\u00a0&#xff08;\u9700\u81ea\u884c\u4eceRuoYi\u9879\u76ee\u4e2d\u590d\u5236\u5e76\u4fee\u6539&#xff09;&#xff1a;<\/p>\n<p>\u00a0 \u00a0\u89e3\u51b3\u65b9\u6848&#xff1a;\u4e0d\u8981\u4f7f\u7528localhost\u6216\u8005127.0.0.1\u3001mysql<\/p>\n<p>\u00a0 \u00a0\u6ce8\u610f&#xff1a;\u9879\u76ee\u914d\u7f6e\u6587\u4ef6\u8ddfdocker-compose.yml \u4fdd\u5b58\u4e00\u81f4<\/p>\n<p># \u6570\u636e\u5e93\u914d\u7f6e<br \/>\nmaster:<br \/>\n  url: jdbc:mysql:\/\/\u4f60\u7684\u670d\u52a1\u5668IP:3306\/ry-cloud? useUnicode&#061;true&amp;characterEncoding&#061;utf8&amp;zeroDateTimeBehavior&#061;convertToNull&amp;useSSL&#061;true&amp;serverTimezone&#061;GMT%2B8<br \/>\n# \u6ce8\u610f\u4f7f\u7528\u670d\u52a1\u540dmysql<br \/>\n  username: root       # MYSQL_USER\u9700\u4e0eRuoYi\u914d\u7f6e\u4e00\u81f4<br \/>\n  password: root&#064;123  # MYSQL_ROOT_PASSWORD\u9700\u4e0eRuoYi\u914d\u7f6e\u4e00\u81f4<\/p>\n<p># Redis\u914d\u7f6e<br \/>\nredis:<br \/>\n  host: redis     # \u4f7f\u7528\u670d\u52a1\u540dredis<br \/>\n  port: 6379<br \/>\n  password: ruoyi&#064;123   # command: redis-server &#8211;requirepass ruoyi&#064;123  # Redis\u5bc6\u7801\u9700\u4e0eRuoYi\u914d\u7f6e\u4e00\u81f4 <\/p>\n<h5 id=\"3.%20%E5%B0%86%E5%90%8E%E7%AB%AF%E6%B7%BB%E5%8A%A0%E5%88%B0%C2%A0docker-compose.yml\" style=\"background-color:transparent\">3. \u5c06\u540e\u7aef\u6dfb\u52a0\u5230\u00a0docker-compose.yml<\/h5>\n<p>services:<br \/>\n  # &#8230; (\u539f\u6709mysql\u548credis\u914d\u7f6e)<\/p>\n<p>   backend:<br \/>\n    build: .\/backend   # \u6307\u5411Dockerfile\u6240\u5728\u76ee\u5f55<br \/>\n    container_name: ruoyi-backend<br \/>\n    depends_on:<br \/>\n      &#8211; mysql<br \/>\n      &#8211; redis<br \/>\n    networks:<br \/>\n      &#8211; ruoyi-net<br \/>\n    environment:<br \/>\n      TZ: Asia\/Shanghai  # \u65f6\u533a\u8bbe\u7f6e <\/p>\n<h4 id=\"%E4%BA%94%E3%80%81%E9%83%A8%E7%BD%B2%E5%89%8D%E7%AB%AF%EF%BC%88Vue%20%2B%20Nginx%EF%BC%89\">\u4e94\u3001\u90e8\u7f72\u524d\u7aef&#xff08;Vue &#043; Nginx&#xff09;<\/h4>\n<h5 id=\"1.%20%E7%BC%96%E8%AF%91%E5%89%8D%E7%AB%AF%E6%96%87%E4%BB%B6\">\u00a01. \u7f16\u8bd1\u524d\u7aef\u6587\u4ef6<\/h5>\n<p>\u00a0\u5728\u672c\u5730\u5f00\u53d1\u73af\u5883\u6267\u884c&#xff1a;<\/p>\n<p>npm run build:prod  # \u751f\u6210dist\u76ee\u5f55 <\/p>\n<p>\u5c06\u00a0dist\u00a0\u6587\u4ef6\u5939\u4e0a\u4f20\u5230\u670d\u52a1\u5668\u7684\u00a0\/opt\/ruoyi\/frontend\u00a0<\/p>\n<h5 id=\"%C2%A02.%20%E7%BC%96%E5%86%99%E5%89%8D%E7%AB%AFDockerfile\">\u00a02. \u7f16\u5199\u524d\u7aefDockerfile<\/h5>\n<p>\u00a0\u521b\u5efa\u00a0frontend\/Dockerfile<\/p>\n<p>FROM nginx:1.21<br \/>\nCOPY dist\/ \/usr\/share\/nginx\/html<br \/>\nCOPY nginx.conf \/etc\/nginx\/conf.d\/default.conf<\/p>\n<h5 id=\"3.%20%E9%85%8D%E7%BD%AENginx%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86\">3. \u914d\u7f6eNginx\u53cd\u5411\u4ee3\u7406<\/h5>\n<p>\u00a0\u521b\u5efa\u00a0frontend\/nginx.conf&#xff1a;<\/p>\n<p>server {<br \/>\n    listen       80;<br \/>\n    server_name  localhost;<\/p>\n<p>    location \/ {<br \/>\n        root   \/usr\/share\/nginx\/html;<br \/>\n        index  index.html index.htm;<br \/>\n        try_files $uri $uri\/ \/index.html;  # \u89e3\u51b3Vue\u8def\u7531History\u6a21\u5f0f404<br \/>\n    }<\/p>\n<p>    location \/prod-api\/ {  # \u524d\u7aef\u8bf7\u6c42\u4ee3\u7406\u5230\u540e\u7aef<br \/>\n        proxy_pass http:\/\/backend:8080\/;  # \u4f7f\u7528\u670d\u52a1\u540dbackend<br \/>\n        proxy_set_header Host $host;<br \/>\n        proxy_set_header X-Real-IP $remote_addr;<br \/>\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br \/>\n    }<\/p>\n<p>    error_page   500 502 503 504  \/50x.html;<br \/>\n    location &#061; \/50x.html {<br \/>\n        root   \/usr\/share\/nginx\/html;<br \/>\n    }<br \/>\n} <\/p>\n<h5 id=\"4.%20%E5%B0%86%E5%89%8D%E7%AB%AF%E6%B7%BB%E5%8A%A0%E5%88%B0%C2%A0docker-compose.yml\">4. \u5c06\u524d\u7aef\u6dfb\u52a0\u5230\u00a0docker-compose.yml<\/h5>\n<p>services:<br \/>\n  # &#8230; (\u539f\u6709\u914d\u7f6e)<\/p>\n<p>  frontend:<br \/>\n    build: .\/frontend<br \/>\n    container_name: ruoyi-frontend<br \/>\n    depends_on:<br \/>\n      &#8211; backend<br \/>\n    ports:<br \/>\n      &#8211; &#034;80:80&#034;     # \u66b4\u9732\u524d\u7aef\u7aef\u53e3<br \/>\n    networks:<br \/>\n      &#8211; ruoyi-net <\/p>\n<h4 id=\"%E5%85%AD%E3%80%81%E5%90%AF%E5%8A%A8%E5%85%A8%E9%83%A8%E6%9C%8D%E5%8A%A1\">\u516d\u3001\u542f\u52a8\u5168\u90e8\u670d\u52a1<\/h4>\n<p>Docker \u547d\u4ee4\u7ec8\u6781\u6307\u5357<\/p>\n<p>cd \/opt\/ruoyi<br \/>\ndocker-compose up -d &#8211;build  # \u6784\u5efa\u955c\u50cf <\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418211144-6802c010201c4.png\" \/><\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418211144-6802c01077036.png\" \/><\/p>\n<h4 id=\"%E4%B8%83%E3%80%81%E9%AA%8C%E8%AF%81%E9%83%A8%E7%BD%B2\">\u4e03\u3001\u9a8c\u8bc1\u90e8\u7f72<\/h4>\n<h5 id=\"1.%20%E6%A3%80%E6%9F%A5%E5%AE%B9%E5%99%A8%E7%8A%B6%E6%80%81\">1. \u68c0\u67e5\u5bb9\u5668\u72b6\u6001<\/h5>\n<p>docker-compose ps  # \u6240\u6709\u5bb9\u5668\u5e94\u4e3arunning <\/p>\n<h5 id=\"2.%20%E6%9F%A5%E7%9C%8B%E6%97%A5%E5%BF%97%E6%8E%92%E6%9F%A5%E9%97%AE%E9%A2%98\">2. \u67e5\u770b\u65e5\u5fd7\u6392\u67e5\u95ee\u9898<\/h5>\n<p>docker logs ruoyi-backend    # \u68c0\u67e5\u540e\u7aef\u542f\u52a8\u65e5\u5fd7<br \/>\ndocker logs ruoyi-frontend   # \u68c0\u67e5Nginx\u914d\u7f6e<br \/>\ndocker logs &#8230;.\u7b49 <\/p>\n<h5 id=\"%C2%A03.%20%E8%AE%BF%E9%97%AE%E6%B5%8B%E8%AF%95\">\u00a03. \u8bbf\u95ee\u6d4b\u8bd5<\/h5>\n<ul>\n<li>\n<p>\u524d\u7aef\u9875\u9762&#xff1a;http:\/\/\u4f60\u7684\u670d\u52a1\u5668IP<\/p>\n<\/li>\n<li>\n<p>\u540e\u7aef\u63a5\u53e3&#xff1a;http:\/\/\u4f60\u7684\u670d\u52a1\u5668IP\/prod-api\/xxxx<\/p>\n<\/li>\n<\/ul>\n<h4 id=\"%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98%C2%A0\">\u5e38\u89c1\u95ee\u9898\u00a0<\/h4>\n<h6 id=\"%C2%A0%201.%E6%A3%80%E6%9F%A5MySQL%E7%94%A8%E6%88%B7%E6%9D%83%E9%99%90\">\u00a0 1.\u68c0\u67e5MySQL\u7528\u6237\u6743\u9650<\/h6>\n<p>docker exec -it ruoyi-mysql mysql -u root -p <\/p>\n<p>\u00a0 \u5728MySQL\u670d\u52a1\u5668\u6267\u884c&#xff1a;<\/p>\n<p>&#8212; \u67e5\u770b\u7528\u6237\u6743\u9650&#xff08;\u66ff\u6362\u5b9e\u9645\u7528\u6237\u540d&#xff09;<br \/>\nSELECT host, user FROM mysql.user WHERE user&#061;&#039;root&#039;;<\/p>\n<p>&#8212; \u6388\u6743\u8fdc\u7a0b\u8bbf\u95ee&#xff08;\u5982\u679c\u9700\u8981&#xff09;<br \/>\nGRANT ALL PRIVILEGES ON *.* TO &#039;root&#039;&#064;&#039;%&#039; IDENTIFIED BY &#039;root&#064;123&#039; WITH GRANT OPTION;<br \/>\nFLUSH PRIVILEGES; <\/p>\n<p>\u00a0 \u542f\u52a8\u00a0mysql\u00a0\u5bb9\u5668\u00a0<\/p>\n<p>docker restart ruoyi-mysql <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e14\u6b21\uff0c\u6536\u85cf12\u6b21\u3002\u82e5\u4f9d(RuoYi)\u662f\u4e00\u6b3e\u57fa\u4e8eSpringBoot+Vue\u7684\u524d\u540e\u7aef\u5206\u79bb\u6743\u9650\u7ba1\u7406\u7cfb\u7edf\uff0c\u91c7\u7528Docker\u90e8\u7f72\u53ef\u4ee5\u7b80\u5316\u73af\u5883\u914d\u7f6e\u3001\u63d0\u5347\u90e8\u7f72\u6548\u7387\u3002\u672c\u6587\u5c06\u901a\u8fc7\u8be6\u7ec6\u6b65\u9aa4\u6f14\u793a\u5982\u4f55\u5728CentOS 7\u670d\u52a1\u5668\u4e0a\u4f7f\u7528Docker\u5bb9\u5668\u5316\u90e8\u7f72\u82e5\u4f9d\u524d\u540e\u7aef\u5206\u79bb\u9879\u76ee\u3002_centeos docker\u5b89\u88ddruoyi<\/p>\n","protected":false},"author":2,"featured_media":21944,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[59,27,58,1307],"topic":[],"class_list":["post-21946","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-centos","tag-docker","tag-linux","tag-liunx"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5728CentOS 7\u670d\u52a1\u5668\u4f7f\u7528Docker\u90e8\u7f72\u82e5\u4f9d(RuoYi)\u524d\u540e\u7aef\u5206\u79bb\u9879\u76ee\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/21946.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5728CentOS 7\u670d\u52a1\u5668\u4f7f\u7528Docker\u90e8\u7f72\u82e5\u4f9d(RuoYi)\u524d\u540e\u7aef\u5206\u79bb\u9879\u76ee\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e14\u6b21\uff0c\u6536\u85cf12\u6b21\u3002\u82e5\u4f9d(RuoYi)\u662f\u4e00\u6b3e\u57fa\u4e8eSpringBoot+Vue\u7684\u524d\u540e\u7aef\u5206\u79bb\u6743\u9650\u7ba1\u7406\u7cfb\u7edf\uff0c\u91c7\u7528Docker\u90e8\u7f72\u53ef\u4ee5\u7b80\u5316\u73af\u5883\u914d\u7f6e\u3001\u63d0\u5347\u90e8\u7f72\u6548\u7387\u3002\u672c\u6587\u5c06\u901a\u8fc7\u8be6\u7ec6\u6b65\u9aa4\u6f14\u793a\u5982\u4f55\u5728CentOS 7\u670d\u52a1\u5668\u4e0a\u4f7f\u7528Docker\u5bb9\u5668\u5316\u90e8\u7f72\u82e5\u4f9d\u524d\u540e\u7aef\u5206\u79bb\u9879\u76ee\u3002_centeos docker\u5b89\u88ddruoyi\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/21946.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-18T21:11:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418211144-6802c010201c4.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/21946.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/21946.html\",\"name\":\"\u5728CentOS 7\u670d\u52a1\u5668\u4f7f\u7528Docker\u90e8\u7f72\u82e5\u4f9d(RuoYi)\u524d\u540e\u7aef\u5206\u79bb\u9879\u76ee\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T21:11:45+00:00\",\"dateModified\":\"2025-04-18T21:11:45+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/21946.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/21946.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/21946.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5728CentOS 7\u670d\u52a1\u5668\u4f7f\u7528Docker\u90e8\u7f72\u82e5\u4f9d(RuoYi)\u524d\u540e\u7aef\u5206\u79bb\u9879\u76ee\u6307\u5357\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5728CentOS 7\u670d\u52a1\u5668\u4f7f\u7528Docker\u90e8\u7f72\u82e5\u4f9d(RuoYi)\u524d\u540e\u7aef\u5206\u79bb\u9879\u76ee\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/21946.html","og_locale":"zh_CN","og_type":"article","og_title":"\u5728CentOS 7\u670d\u52a1\u5668\u4f7f\u7528Docker\u90e8\u7f72\u82e5\u4f9d(RuoYi)\u524d\u540e\u7aef\u5206\u79bb\u9879\u76ee\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e14\u6b21\uff0c\u6536\u85cf12\u6b21\u3002\u82e5\u4f9d(RuoYi)\u662f\u4e00\u6b3e\u57fa\u4e8eSpringBoot+Vue\u7684\u524d\u540e\u7aef\u5206\u79bb\u6743\u9650\u7ba1\u7406\u7cfb\u7edf\uff0c\u91c7\u7528Docker\u90e8\u7f72\u53ef\u4ee5\u7b80\u5316\u73af\u5883\u914d\u7f6e\u3001\u63d0\u5347\u90e8\u7f72\u6548\u7387\u3002\u672c\u6587\u5c06\u901a\u8fc7\u8be6\u7ec6\u6b65\u9aa4\u6f14\u793a\u5982\u4f55\u5728CentOS 7\u670d\u52a1\u5668\u4e0a\u4f7f\u7528Docker\u5bb9\u5668\u5316\u90e8\u7f72\u82e5\u4f9d\u524d\u540e\u7aef\u5206\u79bb\u9879\u76ee\u3002_centeos docker\u5b89\u88ddruoyi","og_url":"https:\/\/www.wsisp.com\/helps\/21946.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T21:11:45+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418211144-6802c010201c4.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/21946.html","url":"https:\/\/www.wsisp.com\/helps\/21946.html","name":"\u5728CentOS 7\u670d\u52a1\u5668\u4f7f\u7528Docker\u90e8\u7f72\u82e5\u4f9d(RuoYi)\u524d\u540e\u7aef\u5206\u79bb\u9879\u76ee\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T21:11:45+00:00","dateModified":"2025-04-18T21:11:45+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/21946.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/21946.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/21946.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u5728CentOS 7\u670d\u52a1\u5668\u4f7f\u7528Docker\u90e8\u7f72\u82e5\u4f9d(RuoYi)\u524d\u540e\u7aef\u5206\u79bb\u9879\u76ee\u6307\u5357"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/21946","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=21946"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/21946\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/21944"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=21946"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=21946"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=21946"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=21946"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}