docker中搭建gitlab
1, 下载镜像
- docker pull sameersbn/gitlab:7.4.3 # 下载gitlab镜像
- docker pull sameersbn/mysql:latest # 下载gitlab所用到的mysql镜像
- docker pull sameersbn/redis:latest # 下载gitlab所用到的redis镜像
2, 启动各个容器
启动redis
* 命令:
docker run \
--name=gitlab_redis \
-tid \
sameersbn/redis:latest
启动mysql
* mkdir -p /opt/gitlab/mysql
命令:
docker run \
--name=gitlab_mysql \
-tid \
-e 'DB_NAME=gitlabhq_production' \
-e 'DB_USER=gitlab' \
-e 'DB_PASS=password' \
-v /opt/gitlab/mysql:/var/lib/mysql \
-p 3306:3306 \
sameersbn/mysql:latest
启动 gitlab
* mkdir -p /opt/gitlab/data /opt/gitlab/log
命令:docker run \
--name='gitlab' \
-itd \
--link gitlab_mysql:mysql \
--link gitlab_redis:redisio \
-e 'GITLAB_PORT=80' \
-e 'GITLAB_SSH_PORT=22' \
-e 'GITLAB_HOST=gitlab.example.com' \
-e 'GITLAB_PROJECTS_LIMIT=10000' \
-e 'GITLAB_EMAIL=gitlab@ofsame.com' -e 'GITLAB_EMAIL_ENABLED=true' -e 'SMTP_ENABLED=true' \
-e 'SMTP_HOST=smtp.exmail.qq.com' -e 'SMTP_PORT=25' -e 'SMTP_STARTTLS=true' -e 'SMTP_USER=gitlab@ofsame.com' -e 'SMTP_PASS=milo1985' \ -v /var/run/docker.sock:/run/docker.sock \
-v $(which docker):/bin/docker \
-v /opt/gitlab/data:/home/git/data \
-v /opt/gitlab/log:/var/log/gitlab \
-p 8888:80 \
sameersbn/gitlab:7.4.3