1

I have a Docker on Windows 10 which uses Ubuntu 20, WSL2, ... but it is very slow. I tried to set up confuguration in .wslconfig file which looks like

# Limits VM memory to use no more than 4 GB, this can be set as whole numbers using GB or MB
memory=8GB 

# Sets the VM to use two virtual processors
processors=4

# Sets amount of swap storage space to 8GB, default is 25% of available RAM
swap=12GB

I have a 16GB RAM on PC so I set up 12GB but docker desctop still shows me 4GB. What can I do to increase performance?

This is the only information about config in docker desctop.

enter image description here

7
  • 2
    You set the swap to 12GB not the memory. Where exactly did you put the WSL configuration file? You did restart your machine, right?
    – Ramhound
    Commented May 23, 2023 at 12:41
  • This was an example file which I found somewhere including the comments. So swap should be RAM but really dont understand what and why memory is 8GB. What should be real walues?
    – Čamo
    Commented May 24, 2023 at 8:55
  • Yes I did restart machine and .wslconfig in in users/username/ directory
    – Čamo
    Commented May 24, 2023 at 8:56
  • My PC has 16GB RAM so I would like to use it. Disc is ssd with full of free space. So what means memory 8GB. Its nothing....
    – Čamo
    Commented May 24, 2023 at 8:57
  • May be I created .wslconfig manually. But docker desctop does not show any usefull info about config only link to microsoft web page.
    – Čamo
    Commented May 24, 2023 at 9:00

2 Answers 2

0

The problem in this case was not the memory. The problem was that whole project vendor direcotry was in volumes. After removing vendor from volumes everything is ok.

0

I experienced similar slow performance issues in windows 10/11 with Docker desktop and WSL2. My solution was when we map the physical volume to container volume, the physical volume should be inside the WSL filesystem except the /mnt.

For e.g in my docker-compose.yaml, I had a line

volumes:
      - /var/www/vhosts:/var/www/html

The "/var/www/vhosts" was inside the WSL filesystem. Once I configured this way my apps were lighting fast.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .