How does resource_class apply to multiple docker images?

The documentation describes the resources available to the docker executor and how to request more/fewer resources.

If I have a build that starts multiple docker images (similar to the config snippet below), are the 2 vCPUs and 4gb RAM shared between them? If not, how are resources allocated?

jobs:
  build:
    docker:
       - image: circleci/ruby:2.4.3-node-browsers
       - image: redis
       - image: vault:latest
       - image: {private_image_1}
       - image: {private_image_2}

resource_class is for the host container as a whole, so all images in a single job are going to be affected by those shared limits.

Ah, I thought the secondary images ran on other host(s), and so the resource limit could not easily be applied to these (or would have to be applied separately)?

Nope, all Docker images for the job are running in the same cgroup on the host.

1 Like