1、镜像保存
docker save gitlab/gitlab-ce:latest -o gitlab-ce.rar
2、将以上镜像拷贝到新服务器上,然后导入
docker load -i gitlab-ce.rar
3、数据拷贝
将原服务器上docker挂载的几个目录直接拷贝到新服务器
Gitlib/etc,Gitlib/log,Gitlib/data
4、容器启动
docker run --publish 10022:22
--publish 8090:8090
--name gitlab
--privileged=true
--restart always
-v /seq_dir/Gitlib/etc:/etc/gitlab
-v /seq_dir/Gitlib/log:/var/log/gitlab
-v /seq_dir/Gitlib/data:/var/opt/gitlab
gitlab/gitlab-ce:latest
5、参考https://zhuanlan.zhihu.com/p/354941496 处理一遍
6、查看各个服务状态
docker exec gitlab gitlab-ctl status
run: alertmanager: (pid 300) 176s; run: log: (pid 291) 176s down: gitaly: (pid 302) 176s; run: log: (pid 298) 176s run: gitlab-exporter: (pid 337) 176s; run: log: (pid 333) 176s run: gitlab-workhorse: (pid 305) 176s; run: log: (pid 304) 176s down: grafana: 1s, normally up, want up; run: log: (pid 296) 176s run: logrotate: (pid 295) 176s; run: log: (pid 292) 176s run: nginx: (pid 311) 176s; run: log: (pid 310) 176s run: postgres-exporter: (pid 341) 176s; run: log: (pid 338) 176s run: postgresql: (pid 303) 176s; run: log: (pid 301) 176s run: prometheus: (pid 309) 176s; run: log: (pid 299) 176s run: puma: (pid 294) 176s; run: log: (pid 293) 176s run: redis: (pid 290) 176s; run: log: (pid 287) 176s run: redis-exporter: (pid 340) 176s; run: log: (pid 339) 176s run: sidekiq: (pid 308) 176s; run: log: (pid 307) 176s run: sshd: (pid 30) 192s; run: log: (pid 29) 192s
7、先解决:down: gitaly: (pid 302) 176s; run: log: (pid 298) 176s
进入容器删除:
进入容器:docker exec -it gitlab bash
rm /var/opt/gitlab/gitaly/gitaly.pid
8、解决:down: grafana: 1s, normally up, want up; run: log: (pid 296) 176s
进入容器,修改该文件夹权限
chown -R gitlab-prometheus:root /var/opt/gitlab/grafana/data
9、以上处理之后可以重启gitlab的容器,所有服务器都是run状态
docker restart gitlab
参考:
https://zhuanlan.zhihu.com/p/354941496 主要参考
https://www.cnblogs.com/forlive/p/12469670.html 解决gitaly down的问题