gitlab9.3.7安装
step 1 安装docker-compose
yum install -y docker-compose
step 2
mkdir /export/gitlab vi /export/gitlab/docker-compose.yml
docker-compose.yml内容在网盘上https://pan.baidu.com/s/1jIR8ygu
step 3
#cd /export/gitlab #docker-compose up #运行改命令会自动下载镜像并启动gitlab [www@cent7-ip199 gitlab]$ docker ps |grep gitlab 13bc64845fc5 10.10.101.199:5000/sameersbn_gitlab:9.3.7 "/sbin/entrypoint.sh " 26 minutes ago Up 26 minutes 443/tcp, 0.0.0.0:10022->22/tcp, 0.0.0.0:10080->80/tcp gitlab_gitlab_1 39f73b3e8689 10.10.101.199:5000/sameersbn_postgresql:9.6-2 "/sbin/entrypoint.sh" 26 minutes ago Up 26 minutes 5432/tcp gitlab_postgresql_1 b91f550d5276 10.10.101.199:5000/sameersbn_redis:latest "/sbin/entrypoint.sh " 26 minutes ago Up 26 minutes 6379/tcp gitlab_redis_1
访问地址:http://10.10.101.199:10080/gitlab/(注:gitlab由参数- GITLAB_RELATIVE_URL_ROOT=/gitlab配置的)
gitlab数据迁移
step 1 备份
##进入容器执行备份命令 [www@cent7-ip199 gitlab]$ docker exec -it gitlab_gitlab_1 bash root@13bc64845fc5:/home/git/gitlab# cd /home/git/gitlab/bin root@13bc64845fc5:/home/git/gitlab/bin# ./rake gitlab:backup:create
命令执行成功后会在宿主机目录/export/gitlab/gitlab/backups生产文件
1508401391_2017_10_19_9.3.7_gitlab_backup.tar
step 2 迁移数据
##进入容器 [www@cent7-ip199 gitlab]$ docker exec -it gitlab_gitlab_1 bash root@13bc64845fc5:/home/git/gitlab#sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production BACKUP=1508401391_2017_10_19_9.3.7 ##执行数据恢复命令,后面的数字是前面备份tar文件前缀
gitlab的root密码忘记怎么办
docker exec -it gitlab_gitlab_1 bash ---进入容器 bundle exec rails console production ---进入修改root密码的界面 user = User.where(id: 1).first ---获取root用户的相关信息 user.password = '密码' ---修改密码 user.password_confirmation = '密码' ---确认密码 user.save! ---保存
gitlab地址变更,超级简单
localhost:project jack$ cd .git localhost:.git jack$ vi config [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true ignorecase = true precomposeunicode = true [remote "origin"] url = http://*这里是要修改的ip和端口*/***/data-project.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master ~