什么是阻止Gitlab Docker容器的安全方法?
我想知道docker stop gitlab
是在按照指令遵循 https://docs.gitlab.com/ee/install/docker.html 。
尽管该GitLab指示没有说明如何停止 在日常使用中安全地安全地告诉我们,在升级gitlab时使用docker stop gitlab
。
我想docker stop $ {container_name}
是停止容器的常见方法,但是不确定10秒的标准超时是否足以停止容器中的所有与GitLab相关的进程。否则,通过执行docker start gitlab
,无法正确重新启动GitLab容器。
我应该承认,我是Docker和Gitlab的新手用户,因此我非常感谢有关如何临时停止Gitlab Docker容器以及如何在日常使用中重新启动它的任何信息。
PS。 实际上,我已经尝试了sudo docker stop gitlab
,在我创建了gitlab docker容器以通过键入来运行它之后:
$ sudo docker run --detach \
--hostname localhost \
--publish 443:443 --publish 80:80 --publish 22:22 \
--name gitlab \
--restart always \
--volume $GITLAB_HOME/config:/etc/gitlab \
--volume $GITLAB_HOME/logs:/var/log/gitlab \
--volume $GITLAB_HOME/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest
并更改了gitlab容器中的root密码。
然后,我已经完成了sudo docker start gitlab
发现我可以使用更改的密码作为root登录,并且GitLab容器中没有问题。
因此,我现在想知道我是幸运还是docker停止gitlab
& Docker Start GitLab
完全是一种安全的方法,可以在Gitlab Docker容器中停止和重新启动与GitLab相关的所有过程。
I'm wondering if docker stop gitlab
is a safe way to stop a GitLab docker container, after I installed a GitLab CE container following the instruction at https://docs.gitlab.com/ee/install/docker.html .
Although that GitLab instruction says nothing about how to stop the
container safely in daily use, it tells us to use docker stop gitlab
in upgrading GitLab.
I suppose that docker stop ${container_name}
is a common way to stop a container, but am not sure if the standard timeout of 10 seconds is always enough to stop all the GitLab-related processes in the container. Otherwise the GitLab container cannot be properly restarted by doing docker start gitlab
.
I should admit that I'm a novice user both of Docker and GitLab, so I'd be very grateful for any information about how to temporarily stop a GitLab docker container and how to restart it in daily use.
ps.
Actually I've tried that sudo docker stop gitlab
, after I created the GitLab docker container to run it by typing :
$ sudo docker run --detach \
--hostname localhost \
--publish 443:443 --publish 80:80 --publish 22:22 \
--name gitlab \
--restart always \
--volume $GITLAB_HOME/config:/etc/gitlab \
--volume $GITLAB_HOME/logs:/var/log/gitlab \
--volume $GITLAB_HOME/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest
and changed the root password in the GitLab container.
Then I've done sudo docker start gitlab
to find that I can login as root with that changed password and that there's no problem in the GitLab container.
So I'm now wondering whether I'm just lucky or docker stop gitlab
& docker start gitlab
is completely a safe way to stop and restart all the GitLab-related processes in a GitLab docker container.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我将参考以下内容:
.com/Engine/Reference/commandline/stop/#选项
您的过程将获得“ Sigterm”,并有10秒钟的关闭。如果他们花费更长的时间,他们将被“ Sigkill”停止。
如果您知道您的流程需要更长的时间,则可以使用“ -t”选项来增加时间。
安全吗?好吧,如果您的硬件超级慢,则GitLab过程可能需要更长的时间,这可能是一个问题。如果您担心它,只需将杀戮时间增加到几分钟即可。如果这段时间不会关闭,那就打破了。
编辑:
我用您的命令创建了一个GitLab容器,并立即将其停止:
该容器尚未完成设置,因此花了10秒。如果我们仔细检查一下,我们可以验证以下内容:
结果:
这可以解释为“ 128 + 9”或“ Sigkill”。
如果我再次启动容器,请让它进行设置并之后停止:
结果:
这只是为了澄清,gitlab docker文件已正确设置,它确实等待了10s。
I would refer to the docker documentation for that:
https://docs.docker.com/engine/reference/commandline/stop/#options
Your process will get a "SIGTERM" and have 10 seconds to shut down. If they take longer, they will be stopped with a "SIGKILL".
If you know that your process needs longer, you could use the "-t" option to increase the time.
Is it safe? Well if your hardware is super slow, a gitlab process might take longer and this could be a problem. If you are worried about it, just increase the killtime to several minutes. If it wont shutdown in this time, something is broken.
EDIT:
I created a gitlab container with your command and stopped it immediately:
The container was not finished setting up, so it took 10s. If we examine it closer, we can verify this:
Result:
This can be interpreted as "128 + 9" or "Sigkill".
If I start the container again, let it set up and stop it afterwards:
Result:
This was just to clarify, that the gitlab docker file is properly set up and it really waits for 10s.
我首先以通常的方式停止GitLab服务:
在我的服务器上,此命令通常在10秒内完成。
即使在服务停止后,容器仍会继续运行,因此您仍然必须使用
docker stop
来停止Docker本身。I would first stop the GitLab service the usual way:
On my server, this command typically completes in more than 10s.
The container continues running even after the service is stopped, so you would still have to stop the docker itself using
docker stop
, as you are doing today.