bitbucket 管道中的 docker 容器出现错误

发布于 2025-01-11 00:30:25 字数 2452 浏览 0 评论 0原文

我正在使用 bitbucket 管道部署我的 dockerized Django 应用程序,但不幸的是,管道已经创建了两个容器,但不是最后一个容器,错误和我的文件附在下面。

错误

ERROR: for db  Cannot create container for service db: authorization denied by plugin pipelines: -v only supports $BITBUCKET_CLONE_DIR and its subdirectories
Encountered errors while bringing up the project.

docker-compose.yml

version: "3.8"

services:
  db:
    container_name: db
    image: "postgres"
    restart: always
    volumes:
      - postgres-data:/var/lib/postgresql/data/

  app:
    container_name: app
    build:
      context: .
    restart: always
    volumes:
      - static-data:/vol/web
    depends_on:
      - db

  proxy:
    container_name: proxy
    build:
      context: ./proxy
    restart: always
    depends_on:
      - app
    ports:
      - 80:8000
    volumes:
      - static-data:/vol/static

volumes:
  postgres-data:
  static-data:

bitbucket-pipelines.yml

image: python:3.7.2

pipelines:
  default:
    - step:
        services:
          - docker
        caches:
          - docker
          - pip
        script:
          - pip install docker-compose
          - docker-compose -f docker-compose-deploy.yml up --build
          - pipe: atlassian/aws-code-deploy:0.2.5
            variables:
              AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
              AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
              AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
              COMMAND: 'upload'
              APPLICATION_NAME: $APPLICATION_NAME
              ZIP_FILE: 'application.zip'
              S3_BUCKET: $S3_BUCKET
              VERSION_LABEL: 'my-app-2.0.0'
          - pipe: atlassian/aws-code-deploy:0.2.5
            variables:
              AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
              AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
              AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
              COMMAND: 'deploy'
              APPLICATION_NAME: $APPLICATION_NAME
              DEPLOYMENT_GROUP: $DEPLOYMENT_GROUP
              WAIT: 'true'
              S3_BUCKET: $S3_BUCKET
              VERSION_LABEL: 'my-app-2.0.0'
              IGNORE_APPLICATION_STOP_FAILURES: 'true'
              FILE_EXISTS_BEHAVIOR: 'OVERWRITE'

definitions:
  services:
    docker:
      memory: 3072
``

I'm deploying my dockerized Django app using bitbucket pipelines but unfortunately, the pipeline already creates two containers but not the last one the error and my files are attached below.

error

ERROR: for db  Cannot create container for service db: authorization denied by plugin pipelines: -v only supports $BITBUCKET_CLONE_DIR and its subdirectories
Encountered errors while bringing up the project.

docker-compose.yml

version: "3.8"

services:
  db:
    container_name: db
    image: "postgres"
    restart: always
    volumes:
      - postgres-data:/var/lib/postgresql/data/

  app:
    container_name: app
    build:
      context: .
    restart: always
    volumes:
      - static-data:/vol/web
    depends_on:
      - db

  proxy:
    container_name: proxy
    build:
      context: ./proxy
    restart: always
    depends_on:
      - app
    ports:
      - 80:8000
    volumes:
      - static-data:/vol/static

volumes:
  postgres-data:
  static-data:

bitbucket-pipelines.yml

image: python:3.7.2

pipelines:
  default:
    - step:
        services:
          - docker
        caches:
          - docker
          - pip
        script:
          - pip install docker-compose
          - docker-compose -f docker-compose-deploy.yml up --build
          - pipe: atlassian/aws-code-deploy:0.2.5
            variables:
              AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
              AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
              AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
              COMMAND: 'upload'
              APPLICATION_NAME: $APPLICATION_NAME
              ZIP_FILE: 'application.zip'
              S3_BUCKET: $S3_BUCKET
              VERSION_LABEL: 'my-app-2.0.0'
          - pipe: atlassian/aws-code-deploy:0.2.5
            variables:
              AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
              AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
              AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
              COMMAND: 'deploy'
              APPLICATION_NAME: $APPLICATION_NAME
              DEPLOYMENT_GROUP: $DEPLOYMENT_GROUP
              WAIT: 'true'
              S3_BUCKET: $S3_BUCKET
              VERSION_LABEL: 'my-app-2.0.0'
              IGNORE_APPLICATION_STOP_FAILURES: 'true'
              FILE_EXISTS_BEHAVIOR: 'OVERWRITE'

definitions:
  services:
    docker:
      memory: 3072
``

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文