2

I have a Docker Compose that consists of ASP.NET Core 5, SQL Server, Elasticsearch & Kibana. If I run it on hyper V mode, it works fine because I can specify 8 GB RAM in the Advanced tab. However, on WSL2 mode, it doesn't let me specify custom RAM. I found the following post Memory allocation to docker containers after moving to WSL 2 in Windows, which states that creating a .wslconfig into %UserProfile% would make it work, but it doesn't seems so. The docker compose is restarting all the time. Is there a way I can specify 8 GB RAM to the WSL2 even as a workaround? I kinda can't use Hyper V mode, because VMware which I need for my job.

docker-compose.yml

version: '3.4'

services:
  db:
    container_name: skybotdb
    image: mcr.microsoft.com/mssql/server:2019-latest
    environment:
      SA_PASSWORD: "SkybotPassword123456"
      ACCEPT_EULA: "Y"
    ports:
      - 1433:1433
    restart: unless-stopped
    volumes:
      - C:\Users\Admin\Desktop\SkybotDb\Backup\Keep:/var/opt/mssql/backups
      - C:\Users\Admin\Desktop\SkybotDb\DockerFiles\datafiles:/var/opt/sqlserver
      - C:\Users\Admin\Desktop\SkybotDb\DockerFiles\system:/var/opt/mssql
    networks:
      - webnet

  skybot.web:
    image: ${DOCKER_REGISTRY-}skybotweb
    build:
      context: .
      dockerfile: src/Skybot.Web/Dockerfile
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - ASPNETCORE_URLS=https://0.0.0.0:5001
      - "UseInMemoryDatabase=false"
      - "ConnectionStrings__DefaultConnection=Server=db;Database=SkybotDb;User=sa;Password=SkybotPassword123456;MultipleActiveResultSets=true"
      - ElasticConfiguration__Uri=http://es01:9200
    ports:
      - 5000:5000
      - 5001:5001
    restart: on-failure
    networks:
      - webnet
    depends_on:
      - db
      - es01

  es01:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.12.0
    container_name: es01
    environment:
      - node.name=es01
      - cluster.name=es-docker-cluster
      - cluster.initial_master_nodes=es01
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - data01:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    restart: unless-stopped
    networks:
      - webnet

  kib01:
    image: docker.elastic.co/kibana/kibana:7.10.1
    container_name: kib01
    ports:
      - 5601:5601
    environment:
      ELASTICSEARCH_URL: http://es01:9200
      ELASTICSEARCH_HOSTS: http://es01:9200
    restart: unless-stopped
    networks:
      - webnet

volumes:
  data01:
    driver: local

networks:
  webnet:
    driver: bridge
nop
  • 4,711
  • 6
  • 32
  • 93

0 Answers0