Im trying to use docker to containerize an asp.net web application and its database. When I run docker-compose for the first time (using the command ‘docker-compose -p app1 up -d’), everything works fine.
When I try to execute another docker-compose (docker-compose -p app2 up -d) at the same time, in order to create a second instance of my web app and its database, the containers wont start. The problem seems to be related to the system resources and more specifically windows 10 virtualisation resource limitations. I tried switching between wsl2 and hyper-v backend. In wsl2 only one docker-compose will run and the second will always fail (no error, the containers just wont start). Using hyper-v backend more than one docker-compose may start, but not always.
I am using Docker Desktop 4.0.0 Windows Containers, on Windows 10 Pro 19041.1165 (16gb ram - i7). Each db container consumes about 0.7-0.8 GB of RAM while each web app container consumes 0.8-1 GB or RAM.
The docker-compose i use looks like this :
version: "3.8" services: web: build: . ports: - "1003:80" depends_on: - db volumes: - "C:\\web-app1:C:\\web-app" - "C:\\backups1:C:\\backups:rw" db: image: "octopusdeploy/mssql-server-windows-express" environment: SA_PASSWORD: "Password_01" ACCEPT_EULA: "Y" ports: - "1004:1433" volumes: - "C:\\testDBs1:C:\\dockerdbdata:rw" - "C:\\backups1:C:\\backups:rw"
The Dockerfile used in order to setup the web app container looks like this :
FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2016 SHELL ["powershell"] RUN Remove-Website -Name 'Default Web Site'; \ New-Website -Name 'web-app' -PhysicalPath 'C:\web-app' -Port 80 -Force EXPOSE 80 RUN Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' \ -Name ServerPriorityTimeLimit -Value 0 -Type DWord