Failed to remove network for the build, Job failed error: Invalid volume specification: “/cache”


Volumes are the preferred mechanism for persisting data generated by and used by Docker containers. While bind mounts are dependent on the directory structure and OS of the host machine, volumes are completely managed by Docker. Volumes have several advantages over bind mounts. They are as follows; Volumes are easier to back up or migrate than bind mounts, you can manage volumes using Docker CLI commands or the Docker API, volumes work on both Linux and Windows containers, Volumes can be more safely shared among multiple containers, volume drivers let you store volumes on remote hosts or cloud providers, to encrypt the contents of volumes, or to add other functionality. New volumes can have their content pre-populated by a container, and volumes on Docker Desktop have much higher performance than bind mounts from Mac and Windows hosts. Kindly refer to some of these related guides: How to install Git on macOS, how to clone a repository and install software from GitHub on Windows, Panic: Failed to register the GitLab-runner, you may be having network issues,

The following error below will be prompted if you are working with the Docker-Windows executor. The GitLab runner needs to be registered with c:\\cache as a source directory, else the following error will be promted when working with a Widnows Container.

Solution: Register GitLab-Runner with “c:\\cache” as the source directory

In order to fix this error above, you will need to edit the config.toml and modify the volume using the Windows File System since we are currently running Windows Container. Below is an example of the configuration for a simple Docker executor running Windows.

image = ""
privileged = false
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["c:\\cache"]
shm_size = 0

When a runner is registered with c:\\cache as a source directory when passing the --docker-volumes or DOCKER_VOLUMES environment variable, there is a known issue.

I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.

Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x