2

I am having a Docker image of virtual size 6.5 GB

REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
Image_Name         latest              d8dcd701981e      About an hour ago        6.565 GB

but the RAM in my system is only 4GB , the container is working at a good speed though , I am really confused as how the RAM allocation is done for the docker containers . Is there any limit to the RAM size being allocated to a container as in the end docker container is just another isolated process running in the Operating system.

kkk
  • 1,850
  • 1
  • 25
  • 45

1 Answers1

0

The virtual size of an image has nothing to do with memory allocation

If your huge image, once launched as a container, does very little, it won't reserve much memory (not consume much CPU)

For more on memory allocation, see this answer: you can limit at runtime the maximum memory allocation. And that, independently of the image size.

For example:

$ docker run -ti -m 300M --memory-swap -1 ubuntu:14.04 /bin/bash

We set memory limit and disabled swap memory limit, this means the processes in the container can use 300M memory and as much swap memory as they need (if the host supports swap memory).

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • i am running a python program using OpencCV and getting a Out of Memory error there .http://stackoverflow.com/questions/34945569/out-of-memory-error-in-opencv3-0-which-is-running-inside-docker-container . Can you suggest anything as why it is happening and i am using the image i specified in my question. – kkk Jan 24 '16 at 04:37
  • @kkk Sure: I have added an answer to your new question. – VonC Jan 24 '16 at 06:44