My goal is to define container definitions("ContainerDefinitions") with appropriate memory size needed in RAM to launch the docker container.
For example, below code snippet for jenkins container(app) gets launched in 500 MB RAM and it works fine, dont know why, given docker image disk size of 1.64GB. here is the Dockerfile.
"EcsTaskDefinition": {
"Type": "AWS::ECS::TaskDefinition",
"Properties": {
"ContainerDefinitions": [
{
"Name": "jenkins",
"Image": "somedockeraccount/jenkins:ecs",
"Memory": 500,
"PortMappings": [ { "ContainerPort": 8080, "HostPort": 8080 } ],
Inspecting a running system in my ubuntu laptop
Below commands are giving disk space of that jenkins image as 1.64GB, which may not be the actual size of docker image:
$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
somedockeraccount/jenkins ecs d9d23cc59412 38 hours ago 1.64GB
$ docker image inspect somedockeraccount/jenkins:ecs | grep -i size
"Size": 1640601180,
"VirtualSize": 1640601180,
Docker image is using overlay2 filesystem(/var/lib/docker/overlay2/)
docker ps -q | xargs docker inspect also shows overlay2 filesystem
Below metadata of docker container on testing locally does not give any clue of RAM size requirement:
$ docker ps -q | xargs docker inspect | grep -i memory
"Memory": 0,
"KernelMemory": 0,
"KernelMemoryTCP": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
In Linux VM world, we generally do not restrct any C/C++/Java app to fit in specific virtual address space boundaries. It is generally 4 GB virtual address apce for 32 bit app. vmstat command also gives clear picture on RAM usage and other resources, by any application process(pid) in Guest OS, as shown below:
Question:
1)
How to find the amount of resources(RAM memory etc..) needed to launch a docker container(say this Dockerfile/app), in docker host? Because "ContainerDefinitions" requires this attribute "Memory" as shown above..
This helps me picking specific EC2 instance type(t2.micro or whatever) in production, based on memory size
2)
Reference does not answer this below question...
Am still unclear, how a RAM size of "Memory":500 MB able to launch docker container for docker image of 1.65 GB (disk space size)?
