Windows Server 2019 + Docker Desktop – AutoStart at startup (boot) computer

From the 2016 year, you can run Linux Containers on Windows 7 from the 2018 year using Windows Server 2019 you can use Linux Container on Windows Server.

Some companies don’t accept Linux on their environment – so in this case, we can run Linux Containers on Windows Server 2019. There is a method on how can we start a docker-composer at Windows Startup (booting computer).

Create a startup file:

E.g. in C:\tmp\bloom_onPrem\startup.ps1

Write-Host “Waiting 180 sec…”
start “C:\Program Files\Docker\Docker\Docker Desktop.exe”
start-service -Name com.docker.service
Start-Sleep 300
Write-Host “Starting containers…”
docker-compose –file c:\tmp\bloom_onPrem\docker-compose.yml up -d
Write-Host “Waiting 15 sec…”
Start-Sleep 15

To start it automatically when the server boot create ScheduledJob with New-JobTrigger – like here:

Open PowerShell as an Administrator and do:

$trigger = New-JobTrigger -AtStartup -RandomDelay 00:00:30
Register-ScheduledJob -Trigger $trigger -FilePath C:\tmp\bloom_onPrem\startup.ps1 -Name BloomOnPrem

Display Scheduled Job:




You can view this definition in Task Scheduler:

BTW: stop.bat file can be:

docker-compose –file c:\tmp\bloom_onPrem\docker-compose.yml down

You can expose your containers to the internet using IIS Reverse Proxy: