简体   繁体   English

如何在Gitlab Runner上将卷挂载到Docker映像? (gitlab-ci.yml)

[英]How to mount a volume to your Docker Image on a Gitlab Runner? (gitlab-ci.yml)

I've running a Docker image for browser testing setup on my gitlab runner. 我已经在gitlab运行程序上运行Docker映像以进行浏览器测试设置。 This is specified in a gitlab-ci.yml like so: 像这样在gitlab-ci.yml中指定:

test:
  stage: test
  services:
    - name: mysql:5.7
      alias: mysql-test
  image: chilio/laravel-dusk-ci:stable
  script:
    - cp .env.ci .env
      ...

Now, when I run multiple tests, the first ones succeed and the rest fails. 现在,当我运行多个测试时,第一个成功,而其他失败。 It seems this might be related to the shared memory, according to this issue: elgalu/docker-selenium#20 . 根据这个问题,看来这可能与共享内存有关: elgalu / docker-selenium#20 I've already increased the shm_size setting on the gitlab runner itself, however I think I need to mount the docker image's shm folder to the runner's shm folder. 我已经在gitlab运行程序本身上增加了shm_size设置,但是我认为我需要将docker映像的shm文件夹安装到运行程序的shm文件夹。 Normally I would specify this in a docker-compose.yml or on the commandline like so: 通常我会在docker-compose.yml或命令行中这样指定:

docker run -v /dev/shm:/dev/shm

However I can't figure out how to do this in the gitlab-ci.yml . 但是我无法在gitlab-ci.yml弄清楚如何做到这gitlab-ci.yml On the image key you can only specify a name and entrypoint ... as documented here image键上,您只能指定nameentrypoint ... 如此处记录

The question is: Can anyone tell me how mount the folder? 问题是:谁能告诉我如何安装文件夹?

ps: for those interested, this is the error: ps:对于那些感兴趣的人,这是错误:

Facebook\WebDriver\Exception\NoSuchDriverException: invalid session id

You have to change your configuration of your gitlab runner to increase shm size 您必须更改gitlab运行程序的配置以增加shm大小

For instance: shm_size = 300000 例如:shm_size = 300000

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM