{"id":19035,"date":"2024-11-19T11:57:37","date_gmt":"2024-11-19T03:57:37","guid":{"rendered":"https:\/\/fwq.ai\/blog\/19035\/"},"modified":"2024-11-19T11:57:37","modified_gmt":"2024-11-19T03:57:37","slug":"%e8%81%8a%e8%81%8amac%e6%80%8e%e4%b9%88%e6%90%ad%e5%bb%bagitlab","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/19035\/","title":{"rendered":"\u804a\u804amac\u600e\u4e48\u642d\u5efagitlab"},"content":{"rendered":"<p>mac\u642d\u5efagitlab &#8211; \u4ece\u96f6\u5f00\u59cb\u5efa\u7acb\u81ea\u5df1\u7684\u4ee3\u7801\u4ed3\u5e93<\/p>\n<p>\u5728\u8f6f\u4ef6\u5f00\u53d1\u4e2d\uff0c\u6211\u4eec\u90fd\u9700\u8981\u4e00\u4e2a\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u6765\u7ba1\u7406\u6211\u4eec\u7684\u4ee3\u7801\u5e93\u3002Git\u662f\u4e00\u4e2a\u5e7f\u6cdb\u4f7f\u7528\u7684\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u800cGitlab\u5219\u662f\u4e00\u4e2a\u63d0\u4f9b\u4ee3\u7801\u6258\u7ba1\u670d\u52a1\u7684\u5e73\u53f0\u3002\u5982\u679c\u4f60\u60f3\u5728\u81ea\u5df1\u7684Mac\u4e0a\u642d\u5efa\u4e00\u4e2aGitlab\u670d\u52a1\u5668\uff0c\u90a3\u672c\u6587\u5c06\u4e3a\u4f60\u63d0\u4f9b\u5fc5\u8981\u7684\u6307\u5f15\u3002<\/p>\n<p>\u7b2c\u4e00\u6b65\uff1a\u5b89\u88c5Docker<\/p>\n<p>Docker\u662f\u4e00\u4e2a\u975e\u5e38\u5f3a\u5927\u7684\u5bb9\u5668\u5316\u5de5\u5177\uff0c\u5b83\u53ef\u4ee5\u8ba9\u4f60\u5728\u4efb\u4f55\u5730\u65b9\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\uff0c\u800c\u65e0\u9700\u62c5\u5fc3\u4f9d\u8d56\u5173\u7cfb\u548c\u73af\u5883\u95ee\u9898\u3002\u4f7f\u7528Docker\u6765\u642d\u5efaGitlab\u975e\u5e38\u65b9\u4fbf\uff0c\u56e0\u4e3a\u5b83\u53ef\u4ee5\u81ea\u52a8\u5316\u5b8c\u6210\u5927\u90e8\u5206\u7684\u914d\u7f6e\u548c\u5b89\u88c5\u3002<\/p>\n<p>\u9996\u5148\uff0c\u4f60\u9700\u8981\u4e0b\u8f7d\u5e76\u5b89\u88c5Docker\u3002\u524d\u5f80\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u5730\u5740\uff1ahttps:\/\/www.docker.com\/products\/docker-desktop<\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u4f60\u9700\u8981\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff0c\u4ee5\u786e\u4fddDocker\u5df2\u7ecf\u6b63\u786e\u5b89\u88c5\uff1a<\/p>\n<pre>docker --version<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5982\u679c\u8f93\u51fa\u6b63\u786e\u7684\u7248\u672c\u53f7\uff0c\u8bf4\u660eDocker\u5df2\u7ecf\u6210\u529f\u5b89\u88c5\u3002<\/p>\n<p>\u7b2c\u4e8c\u6b65\uff1a\u521b\u5efa\u4e00\u4e2aGitlab\u5bb9\u5668<\/p>\n<p>\u5728\u8fd0\u884c\u4e00\u4e2a\u57fa\u4e8eDocker\u7684Gitlab\u5bb9\u5668\u4e4b\u524d\uff0c\u4f60\u9700\u8981\u786e\u4fdd\u4f60\u7684\u7cfb\u7edf\u4e2d\u5df2\u7ecf\u5b58\u5728\u4e00\u4e2aDocker\u7f51\u7edc\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u6765\u521b\u5efa\uff1a<\/p>\n<pre>docker network create gitlab_network<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u7136\u540e\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u8fd0\u884c\u4e00\u4e2a\u65b0\u7684Gitlab\u5bb9\u5668\uff1a<\/p>\n<pre>docker run --detach \n    --hostname gitlab.example.com \n    --name gitlab \n    --network gitlab_network \n    --publish 443:443 \n    --publish 80:80 \n    --publish 22:22 \n    --restart always \n    --volume \/srv\/gitlab\/config:\/etc\/gitlab \n    --volume \/srv\/gitlab\/logs:\/var\/log\/gitlab \n    --volume \/srv\/gitlab\/data:\/var\/opt\/gitlab \n    gitlab\/gitlab-ce:latest<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8be5\u547d\u4ee4\u4e2d\u7684\u6bcf\u4e2a\u53c2\u6570\u90fd\u6709\u4e0d\u540c\u7684\u4f5c\u7528\uff0c\u4e0b\u9762\u505a\u4e00\u4e9b\u7b80\u5355\u7684\u8bf4\u660e\uff1a<\/p>\n<ul>\n<li>&#8211;hostname: \u6307\u5b9aGitlab\u6240\u4f7f\u7528\u7684\u4e3b\u673a\u540d\uff0c\u5728\u8fd9\u91cc\u6211\u4eec\u4f7f\u7528\u4e86\u9ed8\u8ba4\u7684gitlab.example.com\u3002<\/li>\n<li>&#8211;name: \u6307\u5b9aGitlab\u5bb9\u5668\u7684\u540d\u79f0\uff0c\u6211\u4eec\u4f7f\u7528\u4e86\u9ed8\u8ba4\u7684gitlab\u3002<\/li>\n<li>&#8211;network: \u6307\u5b9a\u5bb9\u5668\u6240\u4f7f\u7528\u7684Docker\u7f51\u7edc\u3002<\/li>\n<li>&#8211;publish: \u6307\u5b9a\u4e86Gitlab\u5bb9\u5668\u6240\u4f7f\u7528\u7684\u7aef\u53e3\u6620\u5c04\uff0c\u5177\u4f53\u7684\u542b\u4e49\u53ef\u4ee5\u53c2\u8003\u547d\u4ee4\u4e2d\u7684\u6ce8\u91ca\u3002<\/li>\n<li>&#8211;restart: \u6307\u5b9a\u4e86\u5bb9\u5668\u81ea\u52a8\u91cd\u542f\u7684\u6761\u4ef6\u3002<\/li>\n<li>&#8211;volume: \u6307\u5b9a\u4e86\u5bb9\u5668\u5185\u90e8\u7684\u6570\u636e\u5377\u6302\u8f7d\u7684\u4f4d\u7f6e\u3002<\/li>\n<\/ul>\n<p>\u5728\u8fd9\u4e9b\u53c2\u6570\u7684\u57fa\u7840\u4e0a\uff0c\u6211\u4eec\u4f7f\u7528\u4e86\u6700\u65b0\u7248\u672c\u7684Gitlab-ce\uff0c\u4e5f\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u8981\u4f7f\u7528\u4e0d\u540c\u7684\u7248\u672c\u3002<\/p>\n<p>\u7b2c\u4e09\u6b65\uff1a\u8bbf\u95eeGitlab<\/p>\n<p>\u73b0\u5728\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95eehttp:\/\/localhost\u6216http:\/\/YOUR_IP_ADDRESS\uff08\u6839\u636e\u4f60\u7684\u7f51\u7edc\u914d\u7f6e\uff09\u6765\u8bbf\u95eeGitlab\u4e86\u3002<\/p>\n<p>\u5f53\u4f60\u7b2c\u4e00\u6b21\u8bbf\u95eeGitlab\u65f6\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u4f60\u8bbe\u7f6e\u7ba1\u7406\u5458\u5bc6\u7801\uff0c\u5e76\u8981\u6c42\u4f60\u8f93\u5165\u4e00\u4e2a\u65b0\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\u3002\u5b8c\u6210\u8fd9\u4e9b\u8bbe\u7f6e\u540e\uff0c\u4f60\u5c31\u53ef\u4ee5\u5f00\u59cb\u4f7f\u7528Gitlab\u4e86\u3002<\/p>\n<p>\u603b\u7ed3<\/p>\n<p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5b66\u4e60\u4e86\u5982\u4f55\u5728Mac\u4e0a\u4f7f\u7528Docker\u6765\u642d\u5efaGitlab\u670d\u52a1\u5668\u3002\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u80fd\u591f\u5e2e\u52a9\u4f60\u5feb\u901f\u5efa\u7acb\u81ea\u5df1\u7684\u4ee3\u7801\u4ed3\u5e93\uff0c\u4ee5\u4fbf\u66f4\u597d\u5730\u7ba1\u7406\u548c\u5206\u4eab\u4f60\u7684\u4ee3\u7801\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u804a\u804amac\u600e\u4e48\u642d\u5efagitlab\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>mac\u642d\u5efagitlab &#8211; \u4ece\u96f6\u5f00\u59cb\u5efa\u7acb\u81ea\u5df1\u7684\u4ee3\u7801\u4ed3\u5e93 \u5728\u8f6f\u4ef6\u5f00\u53d1\u4e2d\uff0c\u6211\u4eec\u90fd\u9700\u8981\u4e00\u4e2a\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u6765\u7ba1\u7406\u6211\u4eec\u7684\u4ee3\u7801\u5e93\u3002Git\u662f\u4e00\u4e2a\u5e7f\u6cdb\u4f7f\u7528\u7684\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u800cGitlab\u5219\u662f\u4e00\u4e2a\u63d0\u4f9b\u4ee3\u7801\u6258\u7ba1\u670d\u52a1\u7684\u5e73\u53f0\u3002\u5982\u679c\u4f60\u60f3\u5728\u81ea\u5df1\u7684Mac\u4e0a\u642d\u5efa\u4e00\u4e2aGitlab\u670d\u52a1\u5668\uff0c\u90a3\u672c\u6587\u5c06\u4e3a\u4f60\u63d0\u4f9b\u5fc5\u8981\u7684\u6307\u5f15\u3002 \u7b2c\u4e00\u6b65\uff1a\u5b89\u88c5Docker Docker\u662f\u4e00\u4e2a\u975e\u5e38\u5f3a\u5927\u7684\u5bb9\u5668\u5316\u5de5\u5177\uff0c\u5b83\u53ef\u4ee5\u8ba9\u4f60\u5728\u4efb\u4f55\u5730\u65b9\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\uff0c\u800c\u65e0\u9700\u62c5\u5fc3\u4f9d\u8d56\u5173\u7cfb\u548c\u73af\u5883\u95ee\u9898\u3002\u4f7f\u7528Docker\u6765\u642d\u5efaGitlab\u975e\u5e38\u65b9\u4fbf\uff0c\u56e0\u4e3a\u5b83\u53ef\u4ee5\u81ea\u52a8\u5316\u5b8c\u6210\u5927\u90e8\u5206\u7684\u914d\u7f6e\u548c\u5b89\u88c5\u3002 \u9996\u5148\uff0c\u4f60\u9700\u8981\u4e0b\u8f7d\u5e76\u5b89\u88c5Docker\u3002\u524d\u5f80\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u5730\u5740\uff1ahttps:\/\/www.docker.com\/products\/docker-desktop \u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u4f60\u9700\u8981\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff0c\u4ee5\u786e\u4fddDocker\u5df2\u7ecf\u6b63\u786e\u5b89\u88c5\uff1a docker &#8211;version \u767b\u5f55\u540e\u590d\u5236 \u5982\u679c\u8f93\u51fa\u6b63\u786e\u7684\u7248\u672c\u53f7\uff0c\u8bf4\u660eDocker\u5df2\u7ecf\u6210\u529f\u5b89\u88c5\u3002 \u7b2c\u4e8c\u6b65\uff1a\u521b\u5efa\u4e00\u4e2aGitlab\u5bb9\u5668 \u5728\u8fd0\u884c\u4e00\u4e2a\u57fa\u4e8eDocker\u7684Gitlab\u5bb9\u5668\u4e4b\u524d\uff0c\u4f60\u9700\u8981\u786e\u4fdd\u4f60\u7684\u7cfb\u7edf\u4e2d\u5df2\u7ecf\u5b58\u5728\u4e00\u4e2aDocker\u7f51\u7edc\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u6765\u521b\u5efa\uff1a docker network create gitlab_network \u767b\u5f55\u540e\u590d\u5236 \u7136\u540e\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u8fd0\u884c\u4e00\u4e2a\u65b0\u7684Gitlab\u5bb9\u5668\uff1a docker run &#8211;detach &#8211;hostname gitlab.example.com &#8211;name gitlab &#8211;network gitlab_network &#8211;publish 443:443 &#8211;publish 80:80 &#8211;publish 22:22 &#8211;restart always &#8211;volume \/srv\/gitlab\/config:\/etc\/gitlab &#8211;volume \/srv\/gitlab\/logs:\/var\/log\/gitlab &#8211;volume \/srv\/gitlab\/data:\/var\/opt\/gitlab gitlab\/gitlab-ce:latest \u767b\u5f55\u540e\u590d\u5236 \u8be5\u547d\u4ee4\u4e2d\u7684\u6bcf\u4e2a\u53c2\u6570\u90fd\u6709\u4e0d\u540c\u7684\u4f5c\u7528\uff0c\u4e0b\u9762\u505a\u4e00\u4e9b\u7b80\u5355\u7684\u8bf4\u660e\uff1a &#8211;hostname: \u6307\u5b9aGitlab\u6240\u4f7f\u7528\u7684\u4e3b\u673a\u540d\uff0c\u5728\u8fd9\u91cc\u6211\u4eec\u4f7f\u7528\u4e86\u9ed8\u8ba4\u7684gitlab.example.com\u3002 &#8211;name: \u6307\u5b9aGitlab\u5bb9\u5668\u7684\u540d\u79f0\uff0c\u6211\u4eec\u4f7f\u7528\u4e86\u9ed8\u8ba4\u7684gitlab\u3002 &#8211;network: \u6307\u5b9a\u5bb9\u5668\u6240\u4f7f\u7528\u7684Docker\u7f51\u7edc\u3002 &#8211;publish: \u6307\u5b9a\u4e86Gitlab\u5bb9\u5668\u6240\u4f7f\u7528\u7684\u7aef\u53e3\u6620\u5c04\uff0c\u5177\u4f53\u7684\u542b\u4e49\u53ef\u4ee5\u53c2\u8003\u547d\u4ee4\u4e2d\u7684\u6ce8\u91ca\u3002 &#8211;restart: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-19035","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19035","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=19035"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19035\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=19035"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=19035"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=19035"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}