Try   HackMD

Synology NAS 安裝Docker+Gitlab(DSM 7.0)

安裝Docker

  1. 去套件中心安裝Docker
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

用Docker安裝Gitlab

  1. 在Docker的倉庫伺服器,找關鍵字gitlab,我們下載gitlab/gitlab-ce的映像檔
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

    下載的映像檔會出現在映像檔清單
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  2. 在控制台、共用資料夾,新增gitlab資料夾
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  3. 在File Station的共用資料夾gitlab內新增以下三個資料夾
  • config 來儲存設定檔
  • data 來儲存資料
  • log 來儲存日誌
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  1. 在Docker的映像檔確認gitlab/gitlab-ce下載完成後,按佈署

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  2. 設定容器名稱,建議勾選啟用資源限制,調整記憶體上限(gitlab至少要4G),不調的話會全被吃光,這對Nas不是好事。接著按進階設定

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  3. 設定儲存空間,對應到步驟3的那三個資料夾,在掛載路徑輸入下方紅字。這裡不能錯。

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  • config掛載路徑: /etc/gitlab
    a.基本上,gitlab憑證會放在/etc/gitlab/ssl,所以只要來config裡,更新ssl資料夾的憑證就可以了,別用docker指令進去gitlab容器裡做更新憑證。
    b.記得gitlab要求憑證的檔名要跟dns一模一樣,可以用全域dns的憑證去重新命名就好
    c.請留意,gitlab要的憑證其中一個副檔名是crt,如果手上拿到的是cer,直接改副檔名就可以用了

  • data掛載路徑: /var/opt/gitlab

  • log掛載路徑: /var/log/gitlab

設定完如下圖

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  1. 接著到連接埠設定,如果空白的話,每次gitlab重啟都會換port,很麻煩的。都設定好了就可以按套用。
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  • 註1:本機連接埠就是NAS連接埠。請留意不要有搶port的情形。
  • 註2:容器連接埠用途是。22:ssh。443:https。80:http
  • 註3:如果不確定本機連接埠怎麼選,也可以先空白,看第一次啟動gitlab時docker自動設定什麼port,再回去改就好了。
  1. 到容器,會看到gitlab,在最右邊的開關點一下,gitlab就啟動了。

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  2. 第一次啟動會花約5~10分鐘,我們就可以用瀏覽器輸入http://NAS的IP:49154,到gitlab的登入首頁了

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  3. 剩下的gitlab操作,請參考在Ubuntu裝Docker+Gitlab

參考資料