Resources usage by container

Hello,

How Docker manage resources especially RAM and CPU usage.
For example I run two containers:

1# Postgres
2# Application

Total memory of host is 8GB.

  • How then it will use memory?
  • Is this possible to tweak limit resources for certain container?
    Let’s say I want give for container no1. 6GB of RAM and rest for container no.2