I am using the docker executor to run tests of a PHP (Symfony) project. While executing the tests, cache and log files are written to the file system.
Previously, those files were written to
/dev/shm/<company>/<projectname>, and everything worked fine. Build jobs completed in ~5 minutes.
A couple of days ago, we have re-configured the test suite to write cache and log files to
/run/shm/<company>/<projectname> (instead of
/dev/shm/...). After committing this change, the build job took forever to finish (> 1 hour instead of 5 minutes).
I then re-configured
/etc/gitlab-runner/config.toml to mount the hosts
/run directory as follows:
concurrent = 3 check_interval = 0 [[runners]] name = "runner1" url = "<snip>" token = "<snip>" executor = "docker" [runners.docker] limit = 3 tls_verify = false image = "ubuntu:14.04" privileged = false disable_cache = false volumes = ["/cache", "/run/shm:/run/shm"] pull_policy = "if-not-present" [runners.cache]
This works fine (in terms of build performance) - however, when running multiple build jobs of the same project at the same time (e.g. in different branches), they now obviously overwrite each other’s cache files
So, the next step was to reconfigure the runner to mount the host
/run/shm into the container’s
[[runners]] //... [runners.docker] //... volumes = ["/cache", "/run/shm:/mnt/run/shm"] //... [runners.cache]
and adjust the
.gitlab-ci.yml file to create a pipeline-specific directory inside the mounted tmpfs:
before_script: # The docker image mounts the hosts /run directory # Create a pipeline-specific sub-directory to prevent builds from overwriting each other's cache files - mkdir /mnt/run/shm/$CI_PIPELINE_ID - ln -s /mnt/run/shm/$CI_PIPELINE_ID /run/shm
This works fine for isolating the builds, but again completely kills the performance.
I am using a vanilla docker install on a dedicated Ubuntu 14 “runner” vm with
aufs storage driver:
$ docker info Containers: 40 Running: 0 Paused: 0 Stopped: 40 Images: 154 Server Version: 1.12.3 Storage Driver: aufs // ....
I tried setting
environment = [ "DOCKER_DRIVER=aufs" ] in the gitlab runner config, but this didn’t change anything.
I am relatively new to docker (I only use it for gitlab ci), so I don’t know if I am using the right approach for this. What would be the correct way to get good write performance to
/run/shm from inside a docker-based gitlab ci build?