Mount volumes from repository to service container

So I’m trying to replicate my production setup in pipelines for fun & fail fast…

I’m thinking of versioning my HAProxy configuration for services that are locally load-balanced in their own repo.
(Best Practices aside, we’re burning through decades of technological stagnation as fast as we can…)

Rationale would be that on the pipeline, I would spin an HAProxy service with its configuration file mounted from within the repository.
I know we can easily mount files from the host machine to a container.

Can I mount a file from the git repository into a service container?

Or will I conflict with the normal pipeline execution and try to mount a file that hasn’t been cloned yet?


You can mount temporary volumes into service containers, however, your volume path cannot overlap with the git repository. If you want to include files from your git repository, you need to copy and paste them from the git directories to your temporary directory.

Also note you will probably want to use a detached step instead of a service container (they behave exactly the same but have slightly different syntax). The detached step allows you to control when the service starts; presumably you don’t want it to start until after you have copied the necessary files.

1 Like