Search code examples
dockerdocker-composepipelinebitbucket-pipelines

Bitbucket pipelines authorization denied by plugin pipelines


I am currently trying to build a bitbucket pipeline which is supposed to run a docker-compose file to test a microservice before deployment. The docker compose file is supposed to build my microservice image and run it.

This all seems to work fine locally, however, when I move things to the pipeline I constantly keep getting this error:

#1 [internal] booting buildkit
#1 pulling image moby/buildkit:buildx-stable-1
#1 pulling image moby/buildkit:buildx-stable-1 2.4s done
#1 creating container buildx_buildkit_default 0.0s done
#1 ERROR: Error response from daemon: authorization denied by plugin pipelines: --privileged=true is not allowed
------
 > [internal] booting buildkit:
------
Error response from daemon: authorization denied by plugin pipelines: --privileged=true is not allowed

Dockerfile

FROM node:12-alpine
WORKDIR /app/playground
RUN npm install [email protected]
RUN rm -rf /usr/local/lib/node_modules/npm
RUN mv node_modules/npm /usr/local/lib/node_modules/npm
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
CMD [ "npm", "run", "start" ]

docker-compose.yml

version: "3"
services:
  playground:
    build: .
    ports:
      - 9111:9111
    env_file:
      - ./envs/test.env

I understand that bitbucket pipelines have some mechanism to prevent certain operations from executing for security reasons, but as far as I am aware I am not doing that here.

Any idea of how I could possibly fix this error?


Solution

  • Found 2 working solutions. The more elegant one is to add the following as part of the pipeline script.

    - export DOCKER_BUILDKIT=0

    Source: https://community.atlassian.com/t5/Bitbucket-discussions/Bitbucket-pipelines-authorization-denied-by-plugin-pipelines/td-p/2147800#M3907