docker安裝git

<!DOCTYPE html>javascript

<html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <div class="blog-content-box"> <div class="article-header-box"> <div class="article-header"> <div class="article-title-box"> <h1 class="title-article">docker安裝git</h1> </div> <div class="article-info-box"> <div class="up-time" style="left: 130.156px; display: none;">發佈於2018-07-21 18:13:22</div> <div class="slide-content-box"> <div class="tags-box artic-tag-box"> <span class="label">分類專欄:</span> <a class="tag-link" target="_blank" rel="noopener" href="https://blog.csdn.net/m0_37444820/category_7812173.html"> docker </a> </div> <div class="article-copyright"> <span class="creativecommons"> <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"></a> <span> 版權聲明:本文爲博主原創文章,遵循<a href="http://creativecommons.org/licenses/by-sa/4.0/" target="_blank" rel="noopener"> CC 4.0 BY-SA </a>版權協議,轉載請附上原文出處連接和本聲明。 </span> <div class="article-source-link2222"> 本文連接:<a href="https://blog.csdn.net/m0_37444820/article/details/81147452">https://blog.csdn.net/m0_37444820/article/details/81147452</a> </div> </span> </div> </div> <div class="operating"> <a class="href-article-edit slide-toggle">展開</a> </div> </div> </div> </div> <article class="baidu_pl"> <!--python安裝手冊開始--> <!--python安裝手冊結束--> <!--####專欄廣告位圖文切換開始--> <!--####專欄廣告位圖文切換結束--> <div id="article_content" class="article_content clearfix"> <link rel="stylesheet" href="https://csdnimg.cn/release/phoenix/template/css/ck_htmledit_views-833878f763.css"> <link rel="stylesheet" href="https://csdnimg.cn/release/phoenix/template/css/ck_htmledit_views-833878f763.css"> <div class="htmledit_views" id="content_views"> <p id="安裝docker"><strong>1.安裝docker</strong></p>css

<p>此處主要參考了<a href="https://blog.csdn.net/m0_37444820/article/details/81124353">docker安裝</a></p>html

<p>&nbsp;</p>java

<p><strong>2.拉取git鏡像</strong></p>python

<pre class="has" name="code"><code class="hljs">docker pull gitlab/gitlab-ce:latest</code><div class="hljs-button signin" data-title="登陸後複製" onclick="hljs.signin(event)"></div></pre>git

<p><strong>3.建立docker container (將宿主機SSH端口改成其餘端口,讓出22端口)</strong><br> &nbsp;</p>docker

<pre class="has" name="code"><code class="hljs delphi"><ol class="hljs-ln"><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="1"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">docker run \</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="2"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> --publish <span class="hljs-number">443</span>:<span class="hljs-number">443</span> --publish <span class="hljs-number">80</span>:<span class="hljs-number">80</span> --publish <span class="hljs-number">22</span>:<span class="hljs-number">22</span> \</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="3"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> --<span class="hljs-keyword">name</span> gitlab \</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="4"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> --volume /usr/<span class="hljs-keyword">local</span>/gitlab/config:/etc/gitlab \</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="5"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> --volume /usr/<span class="hljs-keyword">local</span>/gitlab/logs:/<span class="hljs-keyword">var</span>/log/gitlab \</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="6"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> --volume /usr/<span class="hljs-keyword">local</span>/gitlab/data:/<span class="hljs-keyword">var</span>/opt/gitlab \</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="7"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> gitlab/gitlab-ce</div></div></li></ol></code><div class="hljs-button signin" data-title="登陸後複製" onclick="hljs.signin(event)"></div></pre>服務器

<p>把主機的 44三、80、22 端口直接轉發到容器,同時利用 --volume /usr/local/gitlab/config:/etc/gitlab 、 --volume /usr/local/gitlab/logs:/var/log/gitlab 、 --volume /usr/local/gitlab/data:/var/opt/gitlab 這三個參數將 gitlab 的配置、數據和日誌持久化到主機文件系統上來。</p>ide

<p>&nbsp;</p>svg

<p><strong>4. 配置gitlab服務器的訪問地址</strong><br> gitlab容器運行起來是沒有問題的,<br> 可是當gitlab上建立項目的時候,生成項目的URL訪問地址是容器的id。做爲gitlab服務器,固然是須要一個固定的URL訪問地址,因而須要配置gitlab.rb(宿主機上的路徑爲:/usr/local/gitlab/config/gitlab.rb)配置文件裏面的參數。 </p>

<pre class="has" name="code"><code class="hljs python"><ol class="hljs-ln"><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="1"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"># 配置http協議所使用的訪問地址</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="2"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">external_url <span class="hljs-string">'http://192.168.81.121'</span></div></div></li></ol></code><div class="hljs-button signin" data-title="登陸後複製" onclick="hljs.signin(event)"></div></pre>

<p>而後重置:gitlab-ctl reconfigure</p>

<p><img alt="" class="has" height="592" src="https://img-blog.csdn.net/20180721181108133?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L20wXzM3NDQ0ODIw/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" width="762"></p>

<p>而後在重啓:gitlab-ctl restart&nbsp;<br> &nbsp;</p>

<p><strong>5.登陸 gitlab</strong></p>

<p>等待 docker 容器啓動完成後,訪問&nbsp;<a href="https://link.jianshu.com/?t=http%3A%2F%2Fip" rel="nofollow">http://</a>xxxxx 就進入 gitlab 訪問界面。第一次訪問是讓咱們修改管理員密碼。以下所示</p>

<p style="text-indent:50px;"><img alt="" class="has" src="https://upload-images.jianshu.io/upload_images/9436466-305c58067341f338.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/390"> </p>

<p style="text-indent:0;">也能夠經過命令行操做,<a href="https://docs.gitlab.com/ce/security/reset_root_password.html" rel="nofollow">官方文檔</a></p>

<p style="text-indent:0;">建立項目</p>

<p style="text-indent:0;"><img alt="" class="has" height="815" src="https://img-blog.csdn.net/20180721181144851?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L20wXzM3NDQ0ODIw/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" width="1200"></p>

<p style="text-indent:0;"><img alt="" class="has" height="824" src="https://img-blog.csdn.net/20180721181206909?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L20wXzM3NDQ0ODIw/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" width="937"></p></div> <div class="more-toolbox"> <div class="left-toolbox"> <ul class="toolbox-list">

<li class="tool-item tool-active is-like "><a href="javascript:;"> <svg class="icon" aria-hidden="true"> <use xlink:href="#csdnc-thumbsup"></use> </svg>

相關文章
相關標籤/搜索