前言
GitLab官方文档
: https://docs.gitlab.com/omnibus/docker/README.html#install-gitlab-using-docker-compose
DockerComposer
: https://docs.docker.com/compose/install/
步骤
搭建步骤
- docker和docker-compose安装
可参考Jenkins部署中的Docker安装 - 创建本地挂载卷目录
mkdir -p /app/data/gitlab/{data,logs,config} cd /app/data/ chown -R 1000:1000 gitlab/
Local location | Container location | Usage |
$GITLAB_HOME/data |
/var/opt/gitlab |
For storing application data. |
$GITLAB_HOME/logs |
/var/log/gitlab |
For storing logs. |
$GITLAB_HOME/config |
/etc/gitlab |
For storing the GitLab configuration files. |
- 创建docker-compose.yml
version: "3.6" services: gitlab: image: gitlab/gitlab-ee:latest container_name: gitlab restart: always hostname: '192.168.0.89' environment: GITLAB_OMNIBUS_CONFIG: | external_url 'http://192.168.0.89' gitlab_rails['gitlab_shell_ssh_port'] = 2222 ports: - "2222:22" - "80:80" - "443:443" volumes: - /app/data/gitlab/data:/var/opt/gitlab - /app/data/gitlab/logs:/var/log/gitlab - /app/data/gitlab/config:/etc/gitlab
- 运行
docker-compose up -d
使用步骤
- 查看密码
cat /app/data/gitlab/config/initial_root_password
- 访问并登录
默认账户: root 密码: 上面查看的密码
#gitlab服务器IP http://192.168.0.89/
默认是开放注册权限,如果不想开放可以自行设置。
学无止境,谦卑而行.