Memory resources definition while using docker-compose version 3

Hey guys,

I’m running Sonarqube on Docker compose, my file looks like this:

version: "3"


services:
  sonarqube:
    image: sonarqube
    ports:
     - "9000:9000"
     - "5432:5432"
    links:
      - db:db
    environment:
     - SONARQUBE_JDBC_URL=jdbc:postgresql://db:5432/sonar
     - SONARQUBE_JDBC_USERNAME=postgres
     - SONARQUBE_JDBC_PASSWORD=sonar
    volumes:
     - ......../tools/_SonarQube_home/conf:/opt/sonarqube/conf
     - ......../tools/_SonarQube_home/logs:/opt/sonarqube/logs
     - ......../tools/_SonarQube_home/data:/opt/sonarqube/data
     - ......../tools/_SonarQube_home/extensions:/opt/sonarqube/extensions
     - ......../tools/_SonarQube_home/bundled-plugins:/opt/sonarqube/lib/bundled-plugins


  db:
    image: postgres
    environment:
     - POSTGRES_USER=postgres
     - POSTGRES_PASSWORD=sonar
     - POSTGRES_DB=sonar
    volumes:
     - ......../tools/_PostgreSQL_data:/var/lib/postgresql
     # This needs explicit mapping due to https://github.com/docker-library/postgres/blob/4e48e3228a30763913ece952c611e5e9b95c8759/Dockerfile.template#L52
     - ......../tools/_PostgreSQL_data/data:/var/lib/postgresql/data

Everything works and that’s great. One moment I saw that Sonarqube instance started to act slowly, therefore I checked docker stats. It looks like this:

| CPU   | Mem Usage/ Limit   |
|-------| --------------------
| 5.39% | 1.6GiB / 1.952GiB  |

How do I define more RAM resources for the server, let’s say 4 GB? Previously it was mem_limit but now on version 3 it doesn’t exist.
What would be a good solution for that?

Thanks!