How to set the resource_class for docker and machine images

 

If you need more or fewer resources when using CircleCI you can set the resource_class which allows you to use a different amount of resources.

Instructions

The following examples show the one-line change that allows you to set the resource_class to large for a docker build.

If you do not define a resource_class one will be allocated and you can view which was used on the workflows page of a job.

An example where no resource_class is set is shown below:

jobs:
build:
docker:
- image: circleci/ruby:2.7

By adding resource_class: large at the same indentation as docker it will set the resource_class to large.

jobs:
build:
docker:
- image: circleci/ruby:2.7
resource_class: large

An example using a machine executor can be seen below

jobs:
build:
machine:
image: ubuntu-2204:current

By adding resource_class: large at the same indentation as machine it will set the resource_class to large.

jobs:
build:
machine:
image: ubuntu-2204:current
resource_class: large

Outcome

You will now see that on the workflow page, the resource_class that you set is always used.

Additional Resources 

To see all of the available resource_class selections available you can view the following link:

https://circleci.com/docs/configuration-reference/

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.