利用Docker搭建GitLab代码仓库

介绍一下怎样利用docker-gitlab来搭建git代码仓库。

操作:

1:下载搭建gitlab的相关镜像:(这里使用postgresql数据库)

# 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
- [email protected]
- [email protected]
- [email protected]
- 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相关教程见以下内容

GitLab 的详细介绍:请点这里
GitLab 的下载地址:请点这里 

相关推荐