SERVICE_UNAVAILABLE cicd system_error ai_generated true

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

ID: cicd/bitbucket-pipeline-service-unavailable

Also available as: JSON · Markdown · 中文
80%Fix Rate
85%Confidence
1Evidence
2024-01-20First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Bitbucket Pipelines 2024 active — — —
Docker 24.0 active — — —
Ubuntu 22.04 active — — —

Root Cause

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

中文

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

Official Documentation

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

Workarounds

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

中文步骤

  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

Dead Ends

Common approaches that don't work:

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

    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% fail

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

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

    Bitbucket Pipelines blocks external network connections from services for security