It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Pipelines Exceeded Memory Limit - Container exceeded memory limit Edited

Hello,

I'm having increasingly common issues with build failures using Bitbucket Pipelines. While this used to happen only occasionally, it is now happening on nearly every build.

The issue always occurs on:

brunch build --production

 

Error is:

Container 'docker' exceeded memory limit.

 

Here's my bitbucket-pipelines.yml for reference:

 

pipelines:
default:
- step:
name: Deploy to ECS
deployment: production
image: atlassian/pipelines-awscli
size: 2x
services:
- docker
script:
- export AWS_DEFAULT_REGION=${AWS_REGION}
- export AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- export AWS_SECRECT_ACCESS_KEY=${AWS_SECRECT_ACCESS_KEY}

- export IMAGE_NAME="${BITBUCKET_REPO_SLUG}:${BITBUCKET_BUILD_NUMBER}"

- export ECS_CLUSTER_NAME=${BITBUCKET_REPO_SLUG}
- export ECS_SERVICE_NAME=${BITBUCKET_REPO_SLUG}
- export ECS_TASK_NAME=${BITBUCKET_REPO_SLUG}

- docker build -t "${IMAGE_NAME}"
--build-arg MIX_ENV=${MIX_ENV}
--build-arg ... more args ...
.

- ECR_REPO="us-east-1.amazonaws.com"/"${IMAGE_NAME}"
- echo ${ECR_REPO}
- docker tag "${IMAGE_NAME}" "${ECR_REPO}"

- eval $(aws ecr get-login --no-include-email --region ${AWS_REGION})

- docker push "us-east-1.amazonaws.com"/"${IMAGE_NAME}"
- aws ecs list-clusters | grep "${ECS_CLUSTER_NAME}" || aws ecs create-cluster --cluster-name "${ECS_CLUSTER_NAME}"

- export TASK_VERSION=$(aws ecs register-task-definition
--family "${ECS_TASK_NAME}"
--container-definitions
'[{"name":"'"${BITBUCKET_REPO_SLUG}"'","image":"'"${ECR_REPO}"'","memory":512,"entryPoint":[],"portMappings":[{"hostPort":80,"protocol":"tcp","containerPort":4000}]}]'
| jq --raw-output '.taskDefinition.revision')
- echo "Registered ECS Task Definition:" "${TASK_VERSION}"
- aws ecs list-services --cluster "${ECS_CLUSTER_NAME}" | grep "${ECS_SERVICE_NAME}" || aws ecs create-service --service-name "${ECS_SERVICE_NAME}" --cluster "${ECS_CLUSTER_NAME}" --task-definition "${ECS_TASK_NAME}" --desired-count 1
- aws ecs update-service --cluster "${ECS_CLUSTER_NAME}" --service "${ECS_SERVICE_NAME}" --task-definition "${ECS_TASK_NAME}:${TASK_VERSION}"
- export TASK_ARN=$(aws ecs list-tasks --cluster "${ECS_CLUSTER_NAME}" | jq --raw-output '.taskArns[0]')
- aws ecs stop-task --task $TASK_ARN --cluster "${ECS_CLUSTER_NAME}"
- aws ecs run-task --cluster "${ECS_CLUSTER_NAME}" --task-definition "${ECS_CLUSTER_NAME}":"${TASK_VERSION}"
definitions:
service:
docker:
image: bitwalker/alpine-elixir-phoenix:latest

 

Any help or insight is greatly appreciated!

Kevin

 

1 answer

1 accepted

0 votes
Answer accepted

Hi @Kevin Stueber ,

try bumping the memory that is allocated to Docker: https://confluence.atlassian.com/bitbucket/run-docker-commands-in-bitbucket-pipelines-879254331.html#RunDockercommandsinBitbucketPipelines-Dockermemorylimits

 

So specifically, something like this: 

definitions:
  services:
    docker:
      memory: 2048 

Thanks, @Jeroen De Raedt

That solved the issue. I appreciate the help!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Atlassian supported Jenkins integration for Bitbucket Server

We’ve been building a plugin to integrate Bitbucket Server and Jenkins CI, and I’m excited to announce that our alpha is ready to download and install. It lets you seamlessly configure a Jenkins job ...

398 views 0 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you