Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,557,284
Community Members
 
Community Events
184
Community Groups

Pipelines: Increase the Build Container Memory above 1024mb

I am constantly running into the memory limit of the build container, which is, according to the documentation, 1024mb. It is nice that I have 4gb in total (that is, including all the used services) at my disposal, but in my case, I do not need any external services and would rather use the entire 4gb for the build container.

Is there any configuration option that I can use to do so? Even after extensive searching and trial&error, I can't seem to make the build container use more than 1024mb, which is unfortunate.

1 answer

5 votes
Philip Hodder
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Feb 03, 2019

Hi Jan,

By default, the build container has 4GB of memory.

If you add a service container, each will take 1GB of the total 4GB memory.

e.g. 2 service containers. Each service container will have 1GB and the build container will have 2GB of memory.

If you'd like to alter the memory usage of your containers, you have two options:

An example using both features:

pipelines:
default:
- step:
size: 2x # Total memory is 8GB
services:
- my-service-container # Will consume 512MB
script:
# The build container will have 7.5GB remaining.
- echo "Build container memory usage in megabytes:" && echo $((`cat /sys/fs/cgroup/memory/memory.memsw.usage_in_bytes | awk '{print $1}'`/1048576))

definitions:
services:
my-service-container:
image: a-docker-image:tag
memory: 512

Thanks,

Phil

Docs here may be misleading then. They suggest:

  • Regular steps have 4096 MB of memory in total, large build steps (which you can define using size: 2x) have 8192 MB in total.

  • The build container is given 1024 MB of the total memory, which covers your build process and some Pipelines overheads (agent container, logging, etc).

In other words they suggest that the build container is NOT given 4GB, but 1. It is not clear how size: 2x affects this.

In my case no service container was involved, yet a memory limit was reached on the build container (or on Container 'Build' ?). Setting size: 2x did seem to solve the problem although it's hard to tell if this was necessary.

Like # people like this

@josh.sutterfield coud you solve the issue? I am facing the same problem

Like Jorge de Diego likes this

Good option is to....

options:
  docker: true #enabling docker daemon
  size: 2x #doubling memory size of the entire pipe
definitions:
  services:
      docker:
         memory: 2048 #added memory so the container doesnt hang

Example step:
    - step:
          name: 'Build and push new version of the frontend'
          size: 2x #doubling the ammount of memory to this step. By default is 1024M, and we said 2048, so 4096.
          script:
            - docker login -u XXXXXX -p $DOCKER_HUB_PASSWORD
            - docker build -t XXXXX/frontend .
            - docker push XXXXX/frontend
          services:
            - docker
          caches:
            - docker

This should be clarifying.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events