Search code examples
dockergitlabgitlab-ci-runner

gitlab-runner running out of space, with added disk drive


I have a gitlab-runner (docker executor) that is building a large docker image using docker build. This is running out of space.

To remedy this, I mounted an external disk (with adequate space) and created a partition. This can be found and accessed at /run/media/<user>/STORAGE. I created a directory here called builds, where I hope Gitlab-runner to build my docker images (using the new external disks space).

Under the [[runners]] settings in /etc/gitlab-runner/config.toml, I have set builds_dir = "/run/media/<user>/STORAGE/builds".

The gitlab-runner logs suggest that the external disk is being used (Initialized empty Git repository in /run/media/<user>/STORAGE/builds/<user>/<repository-name>/.git/), but the build is still failing at the same stage and time (no space left on device), suggesting that the build itself is still being done on the old disk space.

Have I understood the purpose of the builds_dir setting correctly? How do I get gitlab-runner to just use the new disk?


Solution

  • I solved this by changing the docker data root directory (/var/lib/docker by default) to a folder on my external drive.

    This was done by editing /etc/docker/daemon.json to include the following:

    { 
       "data-root": "/path/to/your/drive" 
    }
    

    I then had to restart docker.