What is the fix for a --mounts is not allowed error? Already implementing - export DOCKER_BUILDKIT=0
Asked by William Tiffin:

I've just encountered an error that when I run a pipeline for testing and linting a Django project. The full error is

```
Error response from daemon: authorization denied by plugin pipelines: --mounts is not allowed
```

As stated I have added in - export DOCKER_BUILDKIT=0 to my script steps. I added this in initially because I was getting a different error which was fixed by adding in - export DOCKER_BUILDKIT=0. I then added some test cases to my code and re-ran the pipeline to check if they were working. And this new error has been appearing.

Things I have already tried:

* Adding in DOCKER_BUILDKIT=0 as a repository variable
* changing the $PATH variable at runtime using export PATH=/usr/bin:$PATH
* Disabling the Docker Buildkit in my Dockerfile.

Here is the code for my bitbucket-pipelines.yml:

```
image: atlassian/default-image:4

options:
docker: true

pipelines:
default:
- parallel:
- step:
name: Test Code
script:
- export DOCKER_BUILDKIT=0
- docker-compose run --rm app sh -c "python manage.py test"
- step:
name: Lint Code
script:
- export DOCKER_BUILDKIT=0
- docker-compose run --rm app sh -c "flake8"
```

Please let me know if anything else is necessary.

I'm just at a bit of a loss as to what is causing this. Is anyone experiencing the same issue? Or has a fix for this?

Thanks


Answers:
author: Ben
body: G'day William!

Thank you for contacting Bitbucket Cloud Support.

To clarify - once you implemented the fix, were your builds running okay for a time before you saw this new error?

As per our documentation, the mount command is not permitted for security reasons - but I can't see this command in the YML you provided (see Running docker commands heading):

* <https://support.atlassian.com/bitbucket-cloud/docs/run-docker-commands-in-bitbucket-pipelines/>

Cheers!

- Ben (Bitbucket Cloud Support)

comments: author: William Tiffin
body: Hi Ben,

Thanks for the response.

Yes I implemented the fix to include

```
- export DOCKER_BUILDKIT=0
```

I then had about three pipelines run correctly before they suddenly started failing.

I then reverted the repo to when the pipelines were running to check that the changes to my code weren't causing the issue. However, even after reverting back the pipelines would still fail.

Thanks for any more information on this,

William


author: Ben
body: Hi William,

Please add the following command before you execute the docker-compose command, I have a feeling there is an issue with the version of docker-compose that is included as part of the base image:

```
curl -L "https://github.com/docker/compose/releases/download/v2.16.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose
```

Once you have included this command, please execute a fresh build and let me know how it goes.

Cheers!

- Ben (Bitbucket Cloud Support)


author: William Tiffin
body: Hi Ben,

```
image: atlassian/default-image:4

options:
  docker: true

pipelines:
  default:
    - parallel:
     - step:
      name: Test Code
      script:
        - export DOCKER_BUILDKIT=0
        - curl -L "https://github.com/docker/compose/releases/download/v2.16.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose
        - docker-compose run --rm app sh -c "python manage.py wait_for_db && python manage.py test"
     - step:
       name: Lint Code
       script:
         - export DOCKER_BUILDKIT=0
         - curl -L "https://github.com/docker/compose/releases/download/v2.16.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose
         - docker-compose run --rm app sh -c "flake8"
```

So I've updated my bitbucket-pipelines.yaml to look like this. Unfortunately, I am still getting the:

```

?Error response from daemon: authorization denied by plugin pipelines: --mounts is not allowed
```

Any Ideas?

Thanks,

Will


author: Theodora Boudale
body: Hi Will,

Please allow me to step in as Ben is out of office.

We would need to check the build logs to figure out why the error occurs. I would recommend creating a ticket with the support team to investigate this further. If we have an open support ticket, the engineer working on it will be able to access the repo and build logs and troubleshooting should be faster.

You can create a ticket via <https://support.atlassian.com/contact/#/>, in "What can we help you with?" select "Technical issues and bugs" and then Bitbucket Cloud as product. Please make sure to provide in the ticket description the URL of a failed build and also of a previously successful build. The support ticket will be visible only to you and Atlassian staff, so anything you post in the ticket won't be publicly visible.

Kind regards,  
Theodora


author: Marc Guyer
body: Anything found here guys? I've run into the same error.


author: William Tiffin
body: Yes. In the end I had to add in the directory names of the volumes I was using into the repository


Tags: bitbucket-cloud

bitbucket-pipelines

cloud