Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Bitbucket pipelines: does Docker volume mounting work yet?

I have a similar issue to this question but I have tried the suggested solutions and volume mounting still does not work.

  • I have verified that the directory I am trying to mount as a volume does exist within my build directory
  • I have run the `docker run ...` bare command with my container, which downloads and runs the container with no problems
  • I have tried using a volume mount with the environment variable, e.g. `docker run -v="$BITBUCKET_CLONE_DIR/dist:/dist" 18fgsa/html-proofer /dist`
  • I have also tried using a volume mount with the absolute path, e.g. `docker run -v="/opt/atlassian/pipelines/agent/build/dist:/dist" 18fgsa/html-proofer /dist`
  • I have also tried the volume mount option in the other format, e.g. `docker run -v "$BITBUCKET_CLONE_DIR/dist:/dist" 18fgsa/html-proofer /dist`

All of these permutations have resulted in the same error:

`docker: Error response from daemon: authorization denied by plugin pipelines: Command not supported.`

Is there some permission which has not been enabled for Docker volume mounts??

3 answers

1 accepted

3 votes
Answer accepted

Ok, for anyone reading this, as per the reply linked above, the answer is that you can currently only mount the bare $BITBUCKET_CLONE_DIR itself as the source for a volume. Any paths below it must be accounted for in your parameters passed to the run command.

So I changed my first example above to:

docker run -v="$BITBUCKET_CLONE_DIR:/app" 18fgsa/html-proofer /app/dist

... and then it worked.

Thanks @Philip Hodder 

I've tried this solution but still running into the error. I'm running

docker-compose run -d -v="$BITBUCKET_CLONE_DIR:/my_app_name" service_name

What am I missing here?

What’s your exact error Chris? Because you’re using `docker-compose` instead of Docker as I was, you may be subject to different permissions. 

Hey Drew, I'm getting this error:

ERROR: for app_name_postgres Cannot create container for service db: authorization denied by plugin pipelines: -v only supports $BITBUCKET_CLONE_DIR and its subdirectories

The “-v” option for mounting volumes doesn’t exist on docker-compose, only on docker itself. 

Check your docker-compose.yml file for other volume mounting directives which may be clashing with the Bitbucket limitations.

https://confluence.atlassian.com/bitbucket/run-docker-commands-in-bitbucket-pipelines-879254331.html

I can't recall the docker-compose CLI reference from 2019 but I'd swear the -v was already valid just as it is now!

https://docs.docker.com/compose/reference/run/

Additionally to only mounting BITBUCKET_CLONE_DIR, beware that files should be world-readable (I guess). That is chmod o+r.

In my case I was creating files with the mktemp tool and they would have 0600 permissions by default. They are fully operable from the pipeline script and permissions are not distinguishable once inside the subcontainer, but they will fail to be read!

Aha, I've just seen this reply to a similar question, I'll try that and see if it works for my issue.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events