Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to create files from docker image running inside the pipeline

Jeroen Benckhuijsen July 29, 2025

Hi,

 

I have a setup where I run some docker images from within the Bitbucket Pipelines build (they are testcontainers, i.e. the docker images are started from within the pipeline, sort of docker-in-docker setup).

One of the images I'm using is mounting a subdirectory of BITBUCKET_CLONE_DIR inside the container and tries to create a file there. This fails, causing the whole build to fail.

I've come across this discussion: https://community.atlassian.com/forums/Bitbucket-questions/Bitbucket-pipelines-how-can-I-map-a-volume-to-docker-to-expose/qaq-p/686951

However, that only discusses creating directories from withint such a docker image, not files. 

I've created a simple test Dockerfile to verify this behavior and creating files indeed seems to fail:

 

FROM node:20

USER 0

RUN mkdir /srv/firebase
RUN mkdir /srv/firebase/kantoordag-next

VOLUME /srv/firebase/kantoordag-next
WORKDIR /srv/firebase/kantoordag-next

ADD testme.sh /srv/testme.sh
RUN chmod +x /srv/testme.sh

CMD /srv/testme.sh

 

And testme.sh is:

#!/bin/sh

who

ls -la /srv/firebase/kantoordag-next
ls -la /srv/firebase/kantoordag-next/node_modules
ls -la /srv/firebase/kantoordag-next/node_modules/.vite-temp

touch /srv/firebase/kantoordag-next/node_modules/.vite-temp/testme || echo "Failed"

echo "Testme creation:"
ls -la /srv/firebase/kantoordag-next/node_modules/.vite-temp

 

1 answer

1 accepted

0 votes
Answer accepted
Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 30, 2025

Hey @Jeroen Benckhuijsen 

Welcome to the community!

I need to see your pipeline YML to understand how you're mounting the volume and identify the failure. Since this is public, I recommend raising a Support ticket on our Support portal for further investigation.

Regards,
Syahrul

Jeroen Benckhuijsen August 7, 2025

Hi,

 

The mounting is actually not done from the pipeline YML, but from the testcontainer which is run. The mounting is performed in the Quarkus Firebase Devcontainer TestContainer image. The exact code which performs the mounting is at:

 

(Note that this issue is triggered by the first mount being performed in this case, but that might just be a timing issue).

I am the co-developer of this extension btw, so we can discuss if anything needs to be changed to work on Bitbucket. Given the origin of the extension, it started out being used on Github, but I am now using it for some repo's running on BB, so trying to get it running there would be great.

KR

Jeroen

 

ps: late reply, vacation time interfered..

Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 11, 2025

Hi Jeroen,

Bitbucket Pipelines have some limitations. To mount a volume, you need to use BuildKit because of restrictions, as mentioned in 'Run Docker commands in Bitbucket Pipelines.'

Please find the following example:

options:
  docker: true
  size: 2x  # Optional: increase resources if needed
pipelines:
  default:
    - step:
        name: Build and Run Testcontainer
        services:
          - docker
        script:
          - export DOCKER_BUILDKIT=0
          - mkdir -p ./srv/firebase/kantoordag-next
          - chmod -R 777 ./srv/firebase/kantoordag-next
          - docker-compose up --build --abort-on-container-exit

Hope this helps

Regards,
Syahrul

Jeroen Benckhuijsen August 12, 2025

Thanks, that worked!

Jeroen Benckhuijsen August 12, 2025

Up until to the point that it didn't...

 

Had a working build, squashed the commits up to that point to clean up the git history, and now it stopped working... I'm at a loss here..

Jeroen Benckhuijsen August 15, 2025

The correct way to solve this is use cloud v3: https://support.atlassian.com/bitbucket-cloud/docs/enable-and-use-runtime-v3/

 

Resolved with the help op the support guys

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events