SERVICE_UNAVAILABLE cicd system_error ai_generated true

错误:服务 'docker' 不可用。请检查服务是否正在运行且可访问。

Error: Service 'docker' is unavailable. Please check that the service is running and accessible.

ID: cicd/bitbucket-pipeline-service-unavailable

其他格式: JSON · Markdown 中文 · English
80%修复率
85%置信度
1证据数
2024-01-20首次发现

版本兼容性

版本状态引入弃用备注
Bitbucket Pipelines 2024 active
Docker 24.0 active
Ubuntu 22.04 active

根因分析

Bitbucket Pipelines无法启动Docker服务,因为管道的构建容器没有Docker守护进程访问权限,或者bitbucket-pipelines.yml中的服务定义配置错误。

English

Bitbucket Pipelines cannot start the Docker service because the pipeline's build container lacks Docker daemon access or the service definition in bitbucket-pipelines.yml is misconfigured.

generic

官方文档

https://support.atlassian.com/bitbucket-cloud/docs/configure-bitbucket-pipelinesyml/

解决方案

  1. Add the Docker service to bitbucket-pipelines.yml:
    definitions:
      services:
        docker:
          image: docker:24.0
    pipelines:
      default:
        - step:
            services:
              - docker
            script:
              - docker info
  2. Use a Bitbucket pipeline image that includes Docker pre-installed, such as atlassian/default-image:4

无效尝试

常见但无效的做法:

  1. Add 'docker: true' to the step definition without defining services 90% 失败

    Docker service must be explicitly listed under 'services:' in the pipeline YAML

  2. Use a custom Docker image without checking if it has Docker installed 70% 失败

    The service requires Docker daemon, which may not be present in custom images

  3. Set DOCKER_HOST environment variable to a remote daemon 85% 失败

    Bitbucket Pipelines blocks external network connections from services for security