19

Gitlab(docker)无限重启(gitlab-ctl: command not found)-我的运维

 4 years ago
source link: https://blog.51cto.com/xiaozhagn/2488779
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Gitlab(docker)无限重启(gitlab-ctl: command not found)

                                           Gitlab(docker)无限重启

前两天构建了一个虚拟机,想着搭建集群,没弄完,就把虚拟机停了,等我重新运行的时候,发现我的gitlab服务炸了,无限重启中。

#docker ps
1.png

一个好习惯,查看日志

#docker logs gitlab
2.png

从gitlab日志知道

/assets/wrapper: line 112: /opt/gitlab/embedded/bin/runsvdir-start: No such file or directory

Configuring GitLab...

/assets/wrapper: line 115: gitlab-ctl: command not found

是runsvdir-start和gitlab-ctl 启动文件找不到。

报错分析:

首先runsvdir-start和gitlab-ctl文件存在与gitlab容器里面,启动时,检查到两个文件丢失,gitlab容器便进入无限重启中。

错误处理:

对于这种,在docker机制下运行的容器,由于gitlab非正常运行,是无法进去到里面的,就算能进去也会很快被强制退出的,所以出现这种就比较复杂一点。

--去官网看了很多关于gitlab(docker)的分析--

发现Docker对于gitlab(docker)的一般删除,数据是保留,而利用这一点,我们就可以baoli一点了。

删除gitlab

#docker rm gitlab

重新构建gitlab

docker run -d --hostname gitlab.xxx.cn \
--publish 443:443 --publish 80:80 --publish 2222:22 \
--name gitlab --restart always --volume /srv/gitlab/config:/etc/gitlab \
--volume /srv/gitlab/logs:/var/log/gitlab \
--volume /srv/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest

查看运行端口

3.png

查看gitlab运行状况

4.png

刷新gitlab界面

我之前创建的项目,并没有丢失,完成了

5.png

有时候发现,一些服务忽然就挂了;耐心点处理,心态就好了


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK