Gitlab亚军:使用自己的(退出)docker集装箱
我注册了一个跑步者
sudo gitlab-ci-multi-runner register
执行器被设置为泊坞窗
现在我被要求的形象,我selectUbuntu的:16.04
但我想用一个自己的容器,我已经准备好了,就像我需要它一样。 我如何使用已经存在的自定义容器?
docker ps 4109775ba06f ubuntu:16.04 "/bin/bash" 25 minutes ago Up 21 minutes want_this_one
Gitlab CI不能使用已经运行的容器。 要做到这一点的方式是以托pipe你的跑步机的机器上的方式build立一个图像。
例如,编写一个Dockerfile,包含构build自定义映像所需的所有步骤:
FROM ubuntu:16.04 # do all the custom steps here RUN apt-get update && apt-get install - yq ...
然后build立你的形象
docker build -t custom_image .
另一种方法是提交你已经存在的容器像这样的图像
docker commit 4109775ba06f custom_image
最后在你的.gitlab-ci.yml
使用你新build的镜像:
image: custom_image