How Do I Stop My Docker Runners From Always Mounting /opt In CI/CD Container To /opt In The Underlying Runner Host?

What are you seeing, and how does it differ from what you expect to see?

I have two Ubuntu servers with Gitlab’s runner installed directly on each of them. I have configured the set of volumes that should be mounted through to the containers used in pipeline jobs when using the Docker executor inside config.toml, and the set does not include /opt or any subdirectory of /opt. At some point, however, the Docker executor on both of them appears to have begun mounting /opt from the underlying host to /opt on whatever container I’m running to execute a CI job. This is causing me problems because a lot of images have things inside /opt that they need to do their job, and those are lost when I run them inside my pipelines. I don’t know if I’ve misconfigured something to make this happen, or if Gitlab updated something and now the /opt directory needs to be mounted no matter what, but any help I could get on this would be appreciated.

Consider including screenshots, error messages, and/or other helpful visuals

I don’t know if screenshots would help, I just know it’s occurring because when I run any CI job that uses the Docker executor, I can add commands like ls /opt in the script step to see that the directory has the contents of the underlying host machine’s /opt directory, and none of what the image should have in its /opt directory, which can be determined by running the container on my local machine.

What version are you on (Hint: /help) ? and are you using self-managed or gitlab.com?

Self-managed on two Ubuntu machines. I have a cron job to update the server and runners automatically every Sunday night, so I’m generally on the latest version. At the time of this post, my server and runners are all on 14.7.0

What troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?

I’ve tried searching Gitlab’s documentation, the general internet, and this forum for information on Gitlab runners always mounting /opt, any ways to configure which volumes are mounted to Docker images automatically other than config.toml on the runner machines, the options available in config.toml files as well as gitlab.rb for the server, and any CI/CD options that would allow me to specify which volumes should be mounted within the pipeline yaml files.