利用Docker搭建GitLab代码仓库

# docker pull buj7itru.mirror.aliyuncs.com/sameersbn/gitlab:latest
# docker pull buj7itru.mirror.aliyuncs.com/sameersbn/postgresql:9.5-3
# docker pull buj7itru.mirror.aliyuncs.com/sameersbn/redis:latest

2:创建数据存储目录:

# mkdir -p /opt/data/docker_gitlab/{gitlab,postgresql,redis}

3:创建docker-compose文件,配置内容如下:

# more docker-compose.yml
version: '2'
services:
redis:
restart: always
image: sameersbn/redis:latest
command:
- --loglevel warning
volumes:
- /opt/data/docker_gitlab/redis:/var/lib/redis:Z
postgresql:
restart: always
image: sameersbn/postgresql:9.5-3
volumes:
- /opt/data/docker_gitlab/postgresql:/var/lib/postgresql:Z
environment:
- DB_USER=gitlab
- DB_PASS=password
- DB_NAME=gitlabhq_production
- DB_EXTENSION=pg_trgm
gitlab:
restart: always
image: sameersbn/gitlab:8.13.5
depends_on:
- redis
- postgresql
ports:
- "10080:80"
- "10022:22"
volumes:
- /opt/data/docker_gitlab//gitlab:/home/git/data:Z
environment:
- DEBUG=false
- DB_ADAPTER=postgresql
- DB_HOST=postgresql
- DB_PORT=5432
- DB_USER=gitlab
- DB_PASS=password
- DB_NAME=gitlabhq_production
- REDIS_HOST=redis
- REDIS_PORT=6379
- TZ=Asia/Shanghai
- GITLAB_HTTPS=false
- SSL_SELF_SIGNED=false
- GITLAB_HOST=localhost
- GITLAB_PORT=10080
- GITLAB_SSH_PORT=10022
- GITLAB_RELATIVE_URL_ROOT=
- GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alphanumeric-string
- GITLAB_SECRETS_SECRET_KEY_BASE=long-and-random-alphanumeric-string
- GITLAB_SECRETS_OTP_KEY_BASE=long-and-random-alphanumeric-string
- GITLAB_ROOT_PASSWORD=
- GITLAB_ROOT_EMAIL=
- GITLAB_NOTIFY_ON_BROKEN_BUILDS=true
- GITLAB_NOTIFY_PUSHER=false
- GITLAB_EMAIL=notifications@example.com
- GITLAB_EMAIL_REPLY_TO=noreply@example.com
- GITLAB_INCOMING_EMAIL_ADDRESS=reply@example.com
- GITLAB_BACKUP_SCHEDULE=daily
- GITLAB_BACKUP_TIME=01:00

4:利用docker-compose创建docker服务:

# docker-compose up -d
Creating root_postgresql_1
Creating root_redis_1
Creating root_gitlab_1

5:由于在compose文件中,我映射了10080端口,我们可以利用这个端口登录,页面会提示你修改密码,之后以root用户与你修改后的密码登录系统即可:

利用Docker搭建GitLab代码仓库

更多GitLab相关教程见以下内容

Ubuntu 14.04下安装GitLab指南 

如何在Ubuntu Server 14.04下安装Gitlab中文版 

CentOS源码安装GitLab汉化版 

在 Ubuntu 12.04 上安装 GitLab

GitLab 5.3 升级注意事项

在 CentOS 上部署 GitLab (自托管的Git项目仓库)

在RHEL6/CentOS6/ScientificLinux6上安装GitLab 6.0.2

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/ec9be0fcfd55fb2a20f407a82f7d0dc8.html