You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed an issue where a process running within a docker container on a Windows VM reported an Out of Memory error according to the logs emitted by docker, however the container itself reported as not exiting due to an OOM error (OOMKilled flag was false when running docker inspect <containerid>) and the exit code reported from the container never matched the expected exit code for an OOM error (Exit code 137). When trying to see if linux had the same behavior when it comes to the process running inside of the container reporting an OOM error, the docker container reported that it was killed due to OOM (OOMKilled flag was true when running docker inspect <containerid> and container reported exit code of 137). I always saw the same behavior in regards to the container reporting that itself wasn't killed due to OOM while the process was reporting OOM errors.
Reproduce
Windows Reproduction Steps:
Created simple DockerFile
FROM mcr.microsoft.com/windows/servercore:ltsc2019
COPY test.ps1 .
ENTRYPOINT ["powershell.exe"]
CMD [".\\test.ps1"]
test.ps1 contents
function Consume-Memory {
$mem = @()
while ($true) {
# Allocate 10 MB of memory
$data = New-Object byte[] (100*1024*1024)
if (-not $data) {
throw "Failed to allocate memory. Exiting..."
}
$mem += $data
Write-Host "Allocated chunks: $($mem.Count)"
Start-Sleep -Seconds 10 # Adjust sleep duration as necessary
}
}
function Main {
Consume-Memory
}
Main
Built an image using the above file docker build -t <yourtaghere> .
Ran a docker container using docker run -m 256 <tag here>
Monitored the container memory usage using docker stats
When container would eventually exit, I inspected the container using docker inspect <containeridhere>
Verified the container did not set the OOMKilled flag as True when the associated docker logs for the container through the path given in the above docker inspect command and process running within the container reported stopping due to an out of memory error.
Linux Reproduction Steps:
These steps are relatively short and simpler than the windows steps.
Created simple Dockerfile
FROM public.ecr.aws/amazonlinux/amazonlinux:latest
CMD ["python3", "-c", "foo=' '*1024*1024*512; import time; time.sleep(10)"]
Built the image and initiated a container from the image with a limit of 512mb for the container. I used docker build -t <yourtaghere> and docker run -m 512 <tag here>
The container would exit almost immediately, emitting exit code 137 which represents an OOM error and the process alongside reported an OutOfMemoryException.
Expected behavior
Docker container running on Windows when encountered with an OutOfMemory error from the process running within the container should report itself as being killed due to OOM error which is the behavior on linux.
docker version
Windows Client:
Client:
Version: 22.06.0-beta.0-189-g4e05b45a90.m
API version: 1.41 (downgraded from 1.42)
Go version: go1.19.2
Git commit: 4e05b45a90
Built: Sat Oct 29 21:48:57 2022
OS/Arch: windows/amd64
Context: default
Server:
Engine:
Version: 20.10.23
API version: 1.41 (minimum version 1.24)
Go version: go1.18.10
Git commit: 6051f14291
Built: Wed Oct 25 18:58:05 2023
OS/Arch: windows/amd64
Experimental: false
Linux Version:
Client:
Version: 20.10.25
API version: 1.41
Go version: go1.19.9
Git commit: b82b9f3
Built: Wed Jul 12 19:37:13 2023
OS/Arch: linux/amd64
Context: default
Experimental: true
Server:
Engine:
Version: 20.10.25
API version: 1.41 (minimum version 1.12)
Go version: go1.19.9
Git commit: 5df983c
Built: Wed Jul 5 00:00:00 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.11
GitCommit: 64b8a811b07ba6288238eefc14d898ee0b5b99ba
runc:
Version: 1.1.11
GitCommit: 4bccb38cc9cf198d52bebf2b3a90cd14e7af8c06
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Description
I noticed an issue where a process running within a docker container on a Windows VM reported an Out of Memory error according to the logs emitted by docker, however the container itself reported as not exiting due to an OOM error (OOMKilled flag was false when running
docker inspect <containerid>
) and the exit code reported from the container never matched the expected exit code for an OOM error (Exit code 137). When trying to see if linux had the same behavior when it comes to the process running inside of the container reporting an OOM error, the docker container reported that it was killed due to OOM (OOMKilled flag was true when runningdocker inspect <containerid>
and container reported exit code of 137). I always saw the same behavior in regards to the container reporting that itself wasn't killed due to OOM while the process was reporting OOM errors.Reproduce
Windows Reproduction Steps:
test.ps1 contents
docker build -t <yourtaghere> .
docker run -m 256 <tag here>
docker stats
docker inspect <containeridhere>
docker inspect
command and process running within the container reported stopping due to an out of memory error.Linux Reproduction Steps:
These steps are relatively short and simpler than the windows steps.
docker build -t <yourtaghere>
anddocker run -m 512 <tag here>
Expected behavior
Docker container running on Windows when encountered with an OutOfMemory error from the process running within the container should report itself as being killed due to OOM error which is the behavior on linux.
docker version
docker info
Additional Info
Process logs from Windows:
docker inspect
logs:The text was updated successfully, but these errors were encountered: