将图层存储在gitlab ci docker执行程序中
我在我的项目上工作的gitlab CI,我创build的图像,使我的testing和构build。 当我在docker执行器中运行它时,每个工作都需要从开始下载镜像。 有没有什么办法在主机上caching/存储这些图层? 像caching? 我试过/ var / lib / docker / aufs存储,但是我不是每个人都想的。 无法find任何解决scheme。 任何人都有这个问题吗? 如何使用它?
gitlab-ci.yml
phpunit: stage: test script: - docker run -w /var/www -v $(pwd):/var/custom --rm phpunit/phpunit:4.8.5
gitlab-ci.yml与卷来自
phpunit: stage: test script: - docker run -w /var/www -v $(pwd):/var/custom --rm --volumes-from {image_from other build} phpunit/phpunit:4.8.5
最好的select是使用专用的长期运行的docker:dind容器,像这样:
docker run --privileged --name gitlab-dind -d --restart=always docker:dind
(如果你的主机支持,添加 – storage-driver = overlay2!)
然后修改config.toml,如下所示:
[runners.docker] tls_verify = false image = "docker:latest" <-------- privileged = false <-------- disable_cache = false volumes = ["/cache"] links = ["gitlab-dind:docker"] <----------- shm_size = 0 [runners.cache]
并删除
services: - docker:dind
来自.gitlab-ci.yml
如果你想从.gitlab-ci.yml运行一个docker容器,你可以这样做:
test: stage: test image: phpunit/phpunit:4.8.5 script: - cd your_source && phpunit
注意我猜测最后一行,因为我不知道phpunit。
好吧,我尝试过让我的服务与音量
FROM docker:dind RUN mkdir /gitlab-runner VOLUME /gitlab-runner
当运行gitlab ci docker执行程序时,我使用命令从docker装入卷
gitlab-ci-multi-runner exec docker phpunit --docker-volumes-from "gitlab-dind" --docker-links "gitlab-dind:docker" --builds-dir "/gitlab-runner"
但不知道为什么我的docker图像和docker服务不共享卷,任何IDE? Gitlab山区有一些思考? 或者除了–docker-volumes-from之外没有任何连接?
- Gitlab CI Runner | 自定义mysql conf
- 无法使用Gitlab-CI在Docker容器中运行Android应用程序
- 如何整合Gitlab CI与我的WordPress插件?
- Docker / CI:访问在另一个阶段创build的nodeJS应用程序
- 清理githost托pipe的gitlab-ci运行器中晃来晃去的Docker容器?
- Docker中的Gitlab Runner
- Gitlab CI中的Docker执行器将错误的URL传递给Git仓库
- 你有任何资源解释如何使用Firebasetesting实验室与GitLabpipe道?
- 在GitLab CI中构buildWPF应用程序时使用什么docker-image