bitbucket pipeline error - container 'docker' exceeded memory limit bitbucket pipeline error - container 'docker' exceeded memory limit docker docker

bitbucket pipeline error - container 'docker' exceeded memory limit


I contacted bitbucket, and they provided a solution:

  • at the beginning of the pipeline (before pipelines:)

options:
  docker: true
  size: 2x

  • at every large step:

name: XXXX
image: google/cloud-sdk:latest
services:
  - docker
size: 2x

  • at the end of the pipeline:

definitions:
  services:
    docker:
      memory: 4096


It is due to your build take more memory than allocatedIn order to resolve this you need add this in your bitbucket-pipelines.yml

image: .....options:      <= Add this  docker: true <= Add this  size: 2x   <= Add thispipelines:  branches:   branches:    master:      - step:          caches:            - ....          services: <= Add this            - docker <= Add thisdefinitions: <= Add this  services: <= Add this    docker: <= Add this      memory: 4096 <= Add this


As said previously you can use size: 2x on a step to increase the memory limit for that step or set it in options which will enable 2x size for all steps automatically.

However, it is worth noting that doing so will consume twice the number of build minutes compared to a regular step, effectively costing twice as much, as described here: https://bitbucket.org/blog/support-large-builds-bitbucket-pipelines