Is it possible to mount a volume in docker container?

I am trying to access large amount of data from within my docker container. Is there a way to either

- run the docker image in a container that also binds a docker volume or
- access the data via a file mount of some sort?

Any help is appreciated.
Regards

0
5 comments

Hello Niklas Karcher!

Please take a look at the Help Article below. The "job.container.mountDir" parameter should help to resolve your request:

https://www.jetbrains.com/help/space/run-a-step-in-a-container.html#dir-structure

 

0

Hi Oleg,
thank you for your reply. It is unclear to me, how I should use the parameter mountDir to achieve what I described above. The documentation states: sets the absolute path to the directory where the Automation volume must be mounted. By default, /mnt/space

This tells the container on where to put for example the checked out repository. But it doesn't tell the container which volume to mount from a set of docker volumes.

- Is there a dedicated docker volume associated to a worker?
- Can I mount this volume in another container to copy the data?
- Can I put data in that volume prior to the worker mounting it?

Thank you for your help!
Regards
Niklas

0

Hello,

I think I am looking for the same thing.

I am building c++ code using docker jobs. I am using vcpkg as dependency manager. To speed up the builds I have a shared vcpkg cache wich is mounted on every space worker host (/mnt/vcpkg).

I am also wondering if it is possible to mount a random directory when we use job.container (https://www.jetbrains.com/help/space/automation-dsl.html#job-container).
e.g. docker run -v /mnt/vcpkg:/mnt/vcpkg -v .:/workdir -w /workdir {{linux-image-tag}} /workdir/automation/linux/build/commit-build.sh -r -t {{run:number}}

0

My current work around is in running the job on the host itself (https://www.jetbrains.com/help/space/automation-dsl.html#job-host).

There I am able to run my docker containers or docker compose scripts however I like.

0

Niklas Karcher

Sorry, it looks like I misled you. 

The only way to do this at the moment is to use the "host" step, call the docker command, and mount the volumes manually. 

The "container" step will be more flexible and will allow doing this once https://youtrack.jetbrains.com/issue/SPACE-18069/Introduce-container-host-actions is done. 

0

Please sign in to leave a comment.