GitLab Docker images

2017-08-31  本文已影响0人  鬼王丶

參考於https://docs.gitlab.com/omnibus/docker/

CentOS版本

$ cat /etc/redhat-release 
CentOS Linux release 7.3.1611 (Core)

1.下載GitLab鏡像

$ sudo docker pull gitlab/gitlab-ce

$ sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
gitlab/gitlab-ce    latest              c90133431e91        2 weeks ago         1.31GB

本人因爲內網,需要設置代理。
創建目錄/etc/systemd/system/docker.service.d ,並創建http-proxy.conf文件,輸入以下內容:

$ cat /etc/systemd/system/docker.service.d/http-proxy.conf 
[Service]
#proxyServer爲代理服務器地址
Environment="HTTP_PROXY=http://proxyServer:PORT" 
Environment="HTTPS_PROXY=http://proxyServer:PORT"

2.啓動容器,運行鏡像

sudo docker run --detach \
    --hostname gitlab.example.com \
    --publish 443:443 --publish 80:80 --publish 22:22 \
    --name gitlab \
    --restart always \
    --volume ~/gitlab/config:/etc/gitlab \
    --volume ~/gitlab/logs:/var/log/gitlab \
    --volume ~/gitlab/data:/var/opt/gitlab \
    gitlab/gitlab-ce:latest

如果你的機器上selinux正在運行,則用下面的方式啓動。

sudo docker run --detach \
    --hostname gitlab.example.com \
    --publish 443:443 --publish 80:80 --publish 22:22 \
    --name gitlab \
    --restart always \
    --volume ~/gitlab/config:/etc/gitlab:Z \
    --volume ~/gitlab/logs:/var/log/gitlab:Z \
    --volume ~/gitlab/data:/var/opt/gitlab:Z \
    gitlab/gitlab-ce:latest
本地位置 容器位置 用途
~/gitlab/config /etc/gitlab 配置目錄
~/gitlab/logs /var/log/gitlab 日誌目錄
~/gitlab/data /var/opt/gitlab 數據目錄

查看selinux狀態

$ sestatus
#配置文件:/etc/selinux/config,SELINUX=disabled禁用selinux,修改後需重啓系統
SELinux status:                 enabled 
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      28

查看容器運行狀態:

$ sudo docker ps -a
CONTAINER ID        IMAGE                     COMMAND             CREATED             STATUS                             PORTS                                                          NAMES
3c3188c3b411        gitlab/gitlab-ce:latest   "/assets/wrapper"   11 seconds ago      Up 10 seconds (health: starting)   0.0.0.0:22->22/tcp, 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   gitlab

4.容器管理

$ sudo docker exec -it gitlab bash
root@gitlab:/# gitlab-ctl reconfigure
上一篇 下一篇

猜你喜欢

热点阅读