You may be using a Docker resource class with a 16GB or higher memory limit. However, be mindful that Remote Docker is not using the resource class resources that you specify.
Remote Docker containers have a set limit of 8GB memory. Any instructions for the Remote Docker will be executed on the remote container with 8GB memory. As such you may hit an
OOM 137 error at 8GB regardless of the resources available to the Docker executor resource class you selected.
You may want to consider using an appropriately sized machine executor in place of Remote Docker. This way you will have control of the specifications of the executor you wish to build on.