如何保存用于在Gitlab CI中执行构建的Docker容器? [英] How can I save the Docker container that was used to perform a build in Gitlab CI?
问题描述
我将Gitlab CI与使用Docker的运行程序结合使用.在Gitlab中一个项目的git仓库中,我放置了一个.gitlab-ci.yml文件.推送此文件将使运行程序根据我提供的Docker映像创建一个Docker容器.然后,它运行yml文件中规定的构建步骤.当构建成功时,这将很好地工作.
I am using Gitlab CI in combination with a runner that uses Docker. In the git repo of a project in Gitlab, I have placed a .gitlab-ci.yml file. Pushing this file causes the runner to create a Docker container based on the Docker image I have provided. It then runs the build steps laid down in the yml file. This works very well when the build succeeds.
但是,当构建失败时,我希望能够在用于运行此构建的Docker容器中找到原因.这可能吗?
However, when the build fails, I would like to be able to find the cause in the Docker container that was used to run this build. Is this possible?
'docker ps'的输出显示该容器在构建期间正在运行,但是随后,'docker ps -a'的输出显示该容器已被完全删除.有什么办法可以防止这种情况?
The output of 'docker ps' shows that the container is running during the build, but afterwards the output of 'docker ps -a' shows that the container was removed completely. Is there any way to prevent this?
推荐答案
很快,使用Web终端(11.3)便可以做到这一点,它将在连接终端时使容器保持活动状态. 网络终端
Soon this will be possible with a web terminal (11.3), which will keep the container alive while the the terminal is connected. webterminal
这篇关于如何保存用于在Gitlab CI中执行构建的Docker容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!