Reputation: 91959
The command that I run is
docker run --rm --cpuset-cpus="0-3" --memory="8g" -v ~/IdeaProjects:/sources --name dsetup -it harit/akka-dev-setup:1.0
When I do htop
inside my container I see that it still uses 2g
I am sure, I am wrong, but not sure where ;-)
Upvotes: 1
Views: 1165
Reputation: 346
The --memory or -m parameter is used to set the limit, it is not used for allocation, From: https://docs.docker.com/engine/reference/run/
Memory reservation is a kind of memory soft limit that allows for greater sharing of memory. Under normal circumstances, containers can use as much of the memory as needed and are constrained only by the hard limits set with the -m/--memory option. When memory reservation is set, Docker detects memory contention or low memory and forces containers to restrict their consumption to a reservation limit.
The ram you are seeing in htop is from your docker host, to view the container RAM and CPU usage use: docker stats
Upvotes: 2