Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Unable to read dockerImage directory when running it through pipe-for-pipeline Edited


team repo:

  • Folder structure:
    - bitbucket-pipelines.yml


    - package.json


QE repo:
The dockerFile used to build our docker image was taken from this repo.

  • Folder structure:
    • dockerFile



I'm running a team repo pipeline and it does pull the docker image and it does try to run our CMD .... command. This CMD command does node tests/test, which is an existing and valid folder/file path.

But I keep getting this error4.png


I added a ls to the dockerFile CMD step to see how the directory looks like, and to my surprise instead of showing QE Repo directory (taken from docker image), it is showing team repo directory.



This is why I keep getting this error message, but to my understanding I should be retrieving dockerImage directory.


Anyone knows what am I missing???? We need to run CMD ls && npm run test-legacy within dockerImage directory.


Thank you


Note 1: All the following commands run good locally

* npm run test-legacy

* node tests/test

* node -e 'require("./tests/test")'

Note 2:  I have debug the docker image, and have confirmed that it has all QE Repo team directory inside of it.

Note 3:  Docker run for our docker image works perfect locally.

2 answers

1 accepted

0 votes
Answer accepted

@tyler.k Hi Tyler, I saw your post on


It seems to be the same issue as I have, but I couldn't figure out how to solve mine yet. Any idea?

Thank you

So the issue lies in how a pipeline runs a docker image. It sets the working directory to be inside of the repo your called your pipeline from it adds the argument --workdir=$(pwd).

So you need to change your directory you are running the commands from after the docker image has started up because I believe arguments added will overwrite what the docker file has set.

In this case we need to change your directory to where you set what your directory is usually when you run your tests

CMD cd /api-automation && ls && npm run test-legacy

Should set you directory to be /api-automation before it trys to run the test

Thank you very much Tyler

I think it's a bug, because I was already setting WORKDIR.

Not really a bug just a "feature" of the way pipelines sets the working directory.


Because pipelines uses the docker run command with a command line argument of 


It will overwrite anything in the dockerfile, which normally makes sense if you're running things from the command line as any arguments you set you'll typically want to overwrite the defaults on the dockerfile.

Definitely can lead to some weird behavior and I think a flag when you're calling pipes would be a nice feature to add if you want to disable it but it would also be hard to find the repo folder that you called the pipeline from if it wasn't set as the working directory.

Definitely wish it was a bit better documented that it was doing this but when you're working with a bunch of different systems together there is always going to be some weird things to figure out. 

Like nicolas.fernandez likes this

Good point. Thank you for your feedback again :thumbsup:

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

366 views 2 10
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you