我看到了Bitbucket Pipeline错误 - 容器“docker”在运行Bitbucket Pipeline时超出了内存限制。我尝试按照以下文档使用所有可能的服务内存限制,但问题未得到解决。
数据库和服务容器 - 服务内存限制
你能帮忙解决这个问题吗?
选项:
docker:true
size:2x
名称:XXXX
镜像:google/cloud-sdk:latest
服务:
- docker
size:2x
定义:
服务:
docker:
memory:4096
由于你的构建占用了比分配的更多内存,需要在你的bitbucket-pipelines.yml文件中添加以下内容来解决此问题
image: .....
options: <= Add this
docker: true <= Add this
size: 2x <= Add this
pipelines:
branches:
branches:
master:
- step:
caches:
- ....
services: <= Add this
- docker <= Add this
definitions: <= Add this
services: <= Add this
docker: <= Add this
memory: 4096 <= Add this
如前所述,您可以在步骤中使用size: 2x
来增加该步骤的内存限制,或者在选项中设置它,这将自动为所有步骤启用2倍大小。
但值得注意的是,这样做将比常规步骤消耗两倍的构建分钟数,实际上需要花费两倍的费用,详见此处。
将流水线yaml更新为以下内容,它能够正常工作:
- step:
name: 'Bitbucket pipeline test'
services:
- docker
size: 2x
definitions:
services:
docker:
memory: 4096 # as per your requirement