1. 程式人生 > >CentOS7下使用docker環境搭建gitlab

CentOS7下使用docker環境搭建gitlab

下載所需docker映象

docker pull index.alauda.cn/sameersbn/gitlab
# docker pull index.alauda.cn/sameersbn/postgresql
docker pull index.alauda.cn/sameersbn/mysql
docker pull index.alauda.cn/sameersbn/redis

開始啟動容器

1. 啟用postgresql (或者不)
# docker run –name=postgresql -d \
# -e ‘DB_NAME=gitlabhq_production’ -e ‘DB_USER=gitlab’ -e ‘DB_PASS=password’ \
# -v /home/postgresql/data:/var/lib/postgresql \
# index.alauda.cn/sameersbn/postgresql

2. 啟用mysql
docker run –name=mysql -itd \
-e ‘DB_NAME=gitlabhq_production’ \
-e ‘DB_USER=gitlab’ \
-e ‘DB_PASS=password’ \
-v /home/gitlab/mysql:/var/lib/mysql \
index.alauda.cn/sameersbn/mysql

3. 啟用資料快取
docker run –restart=always -it –name=redis index.alauda.cn/sameersbn/redis

4. 啟動gitlab
yum install epel-release
yum install pwgen
生成16位隨機字串 GITLAB_SECRETS_DB_KEY_BASE
pwgen bsv1 64

docker run \
–name=’gitlab’ \
-itd \
–link mysql:mysql \
–link redis:redisio \
-p 10022:22 -p 10080:80 \
-e ‘GITLAB_PORT=10080’ \
-e ‘GITLAB_SSH_PORT=10022’ \
-e ‘GITLAB_HOST=gitlab.example.com’ \
-e ‘GITLAB_SECRETS_DB_KEY_BASE=TfxPhW4fRRHwKs5RZT6BDjpjTl2bf6HV3S36MCR8hXn26CQCpZpMFxd3gMLkHcSK’ \
-v /home/gitlab/data:/home/git/data \
-v /home/gitlab/log:/var/log/gitlab \
index.alauda.cn/sameersbn/gitlab