*先决条件系统已安装Docker
1、查询GitLab镜像
docker search gitlab
2、现在GitLab镜像
3、创建文件夹
mkdir -p /software/gitlab/config
mkdir -p /software/gitlab/logs
mkdir -p /software/gitlab/data
4、启动
docker run -d -p 9443:443 -p 9080:80 -p 9022:22 \
--name gitlab --restart always \
--volume /software/gitlab/config:/etc/gitlab \
--volume /software/gitlab/logs:/var/log/gitlab \
--volume /software/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:lates
5、修改配置文件
vi gitlab/config/gitlab.rb
external_url 'http://gitlab.xxx.co'
gitlab_rails['gitlab_ssh_host'] = 'gitlab.xxx.co'
gitlab_rails['gitlab_shell_ssh_port'] = 9022
6、配置nginx
upstream gitlab {
server xxx.xxx.xxx.xxx:9080;
}
server {
listen 80;
server_name gitlab.xxx.co;
location / {
client_max_body_size 10m;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://gitlab;
}
}
7、进入gitlab
首次进入要修改默认管理员密码 (管理员root)