{"id":2505,"date":"2014-11-28T14:08:59","date_gmt":"2014-11-28T06:08:59","guid":{"rendered":"http:\/\/ellery.no-ip.info\/wp\/thinkingmore\/?p=2505"},"modified":"2014-11-28T14:26:49","modified_gmt":"2014-11-28T06:26:49","slug":"gitlab-%e8%88%87-docker","status":"publish","type":"post","link":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/2014\/11\/gitlab-%e8%88%87-docker\/","title":{"rendered":"GitLab \u8207 Docker"},"content":{"rendered":"<p>\u4e4b\u524d\u5c31\u60f3\u8981\u88dd GitLab\uff0c\u7121\u5948\uff0c\u88dd GitLab \u7684\u76f8\u4f9d\u6027\u5be6\u5728\u592a\u591a\uff0c\u5f8c\u4f86\u5c31\u4e0d\u4e86\u4e86\u4e4b\u3002\u6642\u9593\u98db\u5feb\uff0c\u4eca\u5e74\u5e74\u521d\u6642\uff0c\u77e5\u9053\u4e86 Docker \u9019\u500b\u6771\u897f\uff0c\u7136\u5f8c\u6700\u8fd1\u60f3\u5230\u61c9\u8a72\u662f\u53ef\u4ee5\u628a GitLab \u88dd\u5230 Docker \u88e1\uff0c\u9019\u6a23\u5b50 GitLab \u7684\u74b0\u5883\u4e7e\u6de8\uff0c\u4e5f\u4e0d\u6703\u52d5\u5230\u539f\u672c\u4f3a\u670d\u5668\u4e0a\u7684\u8a2d\u5b9a\u3002\u65bc\u662f\u5c31\u4e0a\u7db2 Google \uff0c\u679c\u7136\u5df2\u7d93\u6709\u4eba\u505a\u597d\u4e86 (<a title=\"docker-gitlab\" href=\"https:\/\/github.com\/sameersbn\/docker-gitlab\" target=\"_blank\">sameersbn\/docker-gitlab<\/a>)\uff0c\u90a3\u5c31\u4e0d\u56c9\u5506\uff0c\u7acb\u523b\u4f86\u8a66\u8a66\u770b\u3002<\/p>\n<p><a title=\"docker-gitlab\" href=\"https:\/\/github.com\/sameersbn\/docker-gitlab\" target=\"_blank\">\u7db2\u7ad9\u4e0a\u7684\u5b89\u88dd\u6b65\u9a5f<\/a>\u5176\u5be6\u5df2\u7d93\u883b\u6e05\u695a\u4e86\uff0c\u9019\u88e1\u6211\u5c31\u7d00\u9304\u6211\u6539\u7684\u90e8\u4efd\u3002\u6211\u7528 <a title=\"fig\" href=\"http:\/\/www.fig.sh\/\" target=\"_blank\">fig<\/a> \u4f86\u9032\u884c\u5ba2\u88fd\u5316\uff0c\u6240\u4ee5\u5c31\u5148\u4e0b\u8f09\u4ed6\u7684 <a title=\"fig.yml\" href=\"https:\/\/raw.githubusercontent.com\/sameersbn\/docker-gitlab\/master\/fig.yml\" target=\"_blank\">fig.yml<\/a>\uff0c\u539f\u672c\u7684 fig.yml \u88e1\u6709\u4e09\u500b container\uff0c\u4e00\u500b\u662f gitlab\uff0c\u4e00\u500b\u662f postgresql\uff0c\u4e00\u500b\u662f redis\u3002\u6211\u79fb\u6389\u4e86 postgresql \u8ddf redis\uff0c\u9019\u908a\u6211\u6539\u7528 host \u7684 mysql \u8207 redis\uff0c\u4e26\u4e14\u8a2d\u5b9a\u5fc5\u8981\u7684\u74b0\u5883\u8b8a\u6578\u3002<a title=\"fig\" href=\"http:\/\/www.fig.sh\/\" target=\"_blank\">fig<\/a> \u7684\u5b89\u88dd\u4e00\u5b9a\u8981\u7528 python2 \u7684 pip \u4f86\u5b89\u88dd\uff0c\u5426\u5247\u6703\u6709\u554f\u984c\uff0c\u76ee\u524d\u9084\u6c92\u79fb\u690d\u5230 python3 \u4e0a\u3002<\/p>\n<p>\u8981\u5b58\u53d6 host \u7684 mysql \u8207 redis\uff0c\u8981\u6ce8\u610f\u5e7e\u9ede\uff1a<\/p>\n<ol>\n<li>\u78ba\u5b9a host \u7684 mysql \u8ddf redis \u662f\u53ef\u4ee5\u4ee5 port \u7684\u65b9\u5f0f\u5b58\u53d6\uff0c\u53e6\u5916\u4e5f\u8981\u5141\u8a31\u5916\u90e8 IP \u7684\u9023\u7dda\u3002mysql \u662f\u4fee\u6539 my.cnf \u88e1\u7684 [mysqld] section\uff0c\u4e3b\u8981\u662f\u8a2d\u5b9a port \uff0c\u91cd\u65b0\u555f\u52d5\u4e4b\u5f8c\u61c9\u8a72\u5c31\u53ef\u4ee5\uff1b\u81f3\u65bc redis\uff0c\u5247\u662f\u6539 redis.conf \u88e1\u7684 bind\uff0c\u5c07\u5176\u6539\u70ba bind 0.0.0.0 \uff0c\u91cd\u65b0\u555f\u52d5\u4ee5\u5f8c\u5c31\u53ef\u4ee5\u3002<\/li>\n<li>host \u7684 IP\uff0c\u5728 docker container \u88e1\uff0c\u7167\u7406\u8aaa\u662f\u7528 gateway \u7684 IP \u5c31\u53ef\u4ee5\u3002\u4e00\u822c\u90fd\u662f\u627e\u5230 <code>netstat -nr | grep '^0\\.0\\.0\\.0' | awk '{print $2}'<\/code> \u9019\u6307\u4ee4\uff0c\u4f46\u9019\u5f97\u5728 docker container \u88e1\u57f7\u884c\uff0cfig.yml \u88e1\u6c92\u8fa6\u6cd5\u6307\u5b9a\u9019\u500b\u3002\u5f8c\u4f86\u662f\u770b\u5230\u8aaa\u76f4\u63a5\u7528 host IP \u4e5f\u53ef\u4ee5\uff0c\u6240\u4ee5\u6211\u5c31\u76f4\u63a5\u6307\u5b9a\uff0c\u770b\u8d77\u4f86\u662f\u6c92\u554f\u984c\u3002<\/li>\n<\/ol>\n<p>\u7b49\u8a2d\u5b9a\u597d\u4e4b\u5f8c\uff0c\u76f4\u63a5 fig up\uff0cfig \u5c31\u6703\u5e6b\u4f60 pull image\u3001\u5efa\u7acb image \u7136\u5f8c\u958b\u59cb\u57f7\u884c\uff0c\u7b2c\u4e00\u6b21\u57f7\u884c\u9700\u8981\u82b1\u4e00\u9ede\u6642\u9593\u3002\u9019\u908a\u6211\u78b0\u5230\u7684\u602a\u60c5\u6cc1\uff1a<\/p>\n<ol>\n<li>docker \u6709\u554f\u984c\uff0c\u57f7\u884c\u6709\u554f\u984c\uff0c\u53bb\u67e5\u770b log \uff0c\u770b\u5230 operation not supported \u3002\u67e5\u4e86\u5f88\u4e45\uff0c\u67e5\u4e0d\u51fa\u4f86\u4ec0\u9ebc\u554f\u984c\uff0c\u5f8c\u4f86\u91cd\u958b\u6a5f\uff0c\u5c45\u7136\u5c31\u6c92\u554f\u984c\u4e86\u3002\u4e8b\u5f8c\u731c\u60f3\uff0c\u53ef\u80fd\u662f\u56e0\u70ba\u5728 docker run \u4e4b\u524d\u6709\u66f4\u65b0\u904e kernel\uff0carchlinux \u66f4\u65b0 kernel \u90fd\u662f\u4f7f\u7528 replace \u7684\u65b9\u5f0f\uff0c\u6216\u8a31\u662f\u56e0\u70ba\u9019\u6a23\u800c\u6709\u554f\u984c\u3002<\/li>\n<li>\u4f7f\u7528\u9810\u8a2d\u7684\u5e33\u865f\u8ddf\u5bc6\u78bc\u7121\u6cd5\u767b\u5165\uff0c\u9019\u500b\u5f97\u4f7f\u7528 docker exec -it gitlab_gitlab_1 bash \u9032\u5165 container \u88e1\uff0c\u57f7\u884c sudo -u git -H bash -c \u201cbundle exec rake gitlab:setup RAILS_ENV=production\u201d \u4ee5\u5f8c\uff0c\u5c31\u53ef\u4ee5\u89e3\u6c7a\u3002<\/li>\n<\/ol>\n<div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/5f7041f3017efe6d212a.js\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/5f7041f3017efe6d212a\">Gist<\/a>.<\/noscript><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4e4b\u524d\u5c31\u60f3\u8981\u88dd GitLab\uff0c\u7121\u5948\uff0c\u88dd GitLab \u7684\u76f8\u4f9d\u6027\u5be6\u5728\u592a\u591a\uff0c\u5f8c\u4f86\u5c31\u4e0d\u4e86\u4e86\u4e4b\u3002\u6642\u9593\u98db\u5feb\uff0c\u4eca\u5e74\u5e74\u521d\u6642\uff0c\u77e5\u9053\u4e86 Docker \u9019\u500b\u6771\u897f\uff0c\u7136\u5f8c\u6700\u8fd1\u60f3\u5230\u61c9\u8a72\u662f\u53ef\u4ee5\u628a GitLab \u88dd\u5230 Docker \u88e1\uff0c\u9019\u6a23\u5b50 GitLab \u7684\u74b0\u5883\u4e7e\u6de8\uff0c\u4e5f\u4e0d\u6703\u52d5\u5230\u539f\u672c\u4f3a\u670d\u5668\u4e0a\u7684\u8a2d\u5b9a\u3002\u65bc\u662f\u5c31\u4e0a\u7db2 Google \uff0c\u679c\u7136\u5df2\u7d93\u6709\u4eba\u505a\u597d\u4e86 (sameersbn\/docker-gitlab)\uff0c\u90a3\u5c31\u4e0d\u56c9\u5506\uff0c\u7acb\u523b\u4f86\u8a66\u8a66\u770b\u3002 \u7db2\u7ad9\u4e0a\u7684\u5b89\u88dd\u6b65\u9a5f\u5176\u5be6\u5df2\u7d93\u883b\u6e05\u695a\u4e86\uff0c\u9019\u88e1\u6211\u5c31\u7d00\u9304\u6211\u6539\u7684\u90e8\u4efd\u3002\u6211\u7528 fig \u4f86\u9032\u884c\u5ba2\u88fd\u5316\uff0c\u6240\u4ee5\u5c31\u5148\u4e0b\u8f09\u4ed6\u7684 fig.yml\uff0c\u539f\u672c\u7684 fig.yml \u88e1\u6709\u4e09\u500b container\uff0c\u4e00\u500b\u662f gitlab\uff0c\u4e00\u500b\u662f postgresql\uff0c\u4e00\u500b\u662f redis\u3002\u6211\u79fb\u6389\u4e86 postgresql \u8ddf redis\uff0c\u9019\u908a\u6211\u6539\u7528 host \u7684 mysql \u8207 redis\uff0c\u4e26\u4e14\u8a2d\u5b9a\u5fc5\u8981\u7684\u74b0\u5883\u8b8a\u6578\u3002fig \u7684\u5b89\u88dd\u4e00\u5b9a\u8981\u7528 python2 \u7684 pip \u4f86\u5b89\u88dd\uff0c\u5426\u5247\u6703\u6709\u554f\u984c\uff0c\u76ee\u524d\u9084\u6c92\u79fb\u690d\u5230 python3 \u4e0a\u3002 \u8981\u5b58\u53d6 host \u7684 mysql \u8207 redis\uff0c\u8981\u6ce8\u610f\u5e7e\u9ede\uff1a \u78ba\u5b9a host \u7684 mysql \u8ddf redis \u662f\u53ef\u4ee5\u4ee5 port \u7684\u65b9\u5f0f\u5b58\u53d6\uff0c\u53e6\u5916\u4e5f\u8981\u5141\u8a31\u5916\u90e8 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/2014\/11\/gitlab-%e8%88%87-docker\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;GitLab \u8207 Docker&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[8],"tags":[64,81,29,105],"class_list":["post-2505","post","type-post","status-publish","format-standard","hentry","category-linux-","tag-docker","tag-gitlab","tag-linux","tag-scm"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2MOxp-Ep","_links":{"self":[{"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/posts\/2505","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/comments?post=2505"}],"version-history":[{"count":3,"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/posts\/2505\/revisions"}],"predecessor-version":[{"id":2512,"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/posts\/2505\/revisions\/2512"}],"wp:attachment":[{"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/media?parent=2505"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/categories?post=2505"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/tags?post=2505"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}