FIX: Out of memory error when you run SQL Server 2017 in a Linux Docker container

Applies to: SQL Server 2017 DeveloperSQL Server 2017 EnterpriseSQL Server 2017 Enterprise Core

Symptoms


When you run an instance of Microsoft SQL Server 2017 inside a Linux Docker container, you may receive an out-of-memory error message.

Cause


SQL Server on Linux by default uses a soft limit of 80% of total physical memory when memory.memorylimitmb configuration is not enabled; For Docker containers SQL used to consider 80% of total host memory instead of limiting itself to 80% memory allocated to the docker container. This incorrect memory limit allows SQL Server to try to consume memory more than that is available for container and could be a candidate for termination by OOM Killer.

Note When you create the Docker image you have to specify –m to limit the Docker memory. Refer following article for more information.

Create Docker

Resolution


A fix for this issue is included in the following update for SQL Server:

Cumulative Update 10 for SQL Server 2017 

Note If memory.memorylimitmb configuration is not configured then this Fix allows SQL Server to limit itself to a soft limit of 80% of allocated memory to the container.

Status


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

References


Learn about the standard terminology Microsoft uses to describe software updates.