We've configured a linux docker self hosted runner in our environment and need to move build artifacts from the docker container to a windows file share. We do not have ssh or sftp available and cannot use those utilities at this time.
I attempted to mount the windows file share using CIFS as we do something similar on our windows containers (in Jenkins) using net use.
mount -t cifs \
-o username=your_user,password=your_password,domain=your_domain \
//your/file/share \
/mnt/share
However, this does not seem possible as I am getting the following error:
Unable to apply new capability set.How can I mount my windows file share within a self-runner linux docker container?
Update 2025/10/11:
It appears this this may now be possible with Runtime v3 with the Privileged flag but I'm still not sure on a couple things.
#2 with something like `privileged: true` would be beneficial as I could run multiple steps in the privileged container via the scripts property(ies) rather than encoding them in the docker run command itself (which may be rather long when I have multiple steps).
It appears this this may now be possible with Runtime v3 with the Privileged flag using Docker in Docker. Here's a pipeline working pipeline. (Add the definitions block was key as discussed in this post)
definitions:
services:
docker-custom:
type: docker
image: docker:dind
image: atlassian/default-image:4
pipelines:
default:
- step:
name: Privileged Runner
runtime:
cloud:
version: 3
services:
- docker-custom
runs-on:
- "self.hosted"
- "linux"
script:
- docker run --privileged alpine:3 sh -c "apk update && apk add cifs-utils && mkdir /mnt/gis && mount -t cifs -o username=$USR,password=$ PSW,domain=$DOMAIN //server.domain.local/share/gis /mnt/gis && ls /mnt/gis"
It's a bit messy though as, AFAIK, the entire command needs to be executed in the docker run -c and would not be available in subsequent commands
What I was really hoping for was something more akin to the following (note the privileged prop).
# EXAMPLE ONLY. NOT A WORKING SAMPLE
pipelines:
default:
- step:
name: Privileged Runner
runtime:
cloud:
version: 3
privileged: true # mark the container as privileged
runs-on:
- "self.hosted"
- "linux"
script:
- apk update
- apk add cifs-utils
- mkdir /mnt/gis
- mount -t cifs -o username=$USR,password=$ PSW,domain=$DOMAIN //server.domain.local/share/gis /mnt/gis
- ls /mnt/gis
Ultimately, though I have settled installing OpenSSH on the Windows Server and using scp to copy files over. This means I don't need to use DinD and the pipeline becomes simpler. Will likely use rsync for better performance, and syncing features.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.