The following is a sample PS script I use to create Docker containers. All content in ‘<>’ brackets should be replaced with values.
For example: <license file path> might be something like, C://licenses/version 18.flf
$artifactUrl = Get-BCArtifactUrl -type OnPrem -country us -select Latest
# $imageName = 'mcr.microsoft.com/businesscentral/sandbox:us'
$licenseFile = '<license file path>'
$ContainerName = '<containerName>' # should be the same as the ServerName in launch.json for the app
$UserName = '<userName>' # this is the Super User for the container
$Password = ConvertTo-SecureString '<passwordString>' -AsPlainText -Force
$Credential = New-Object System.Management.Automation.PSCredential ($UserName, $Password)
New-BCContainer `
-accept_eula `
-containerName $ContainerName `
-memoryLimit 6G `
-artifactUrl $artifactUrl `
-licenseFile $licenseFile `
-auth NavUserPassword `
-updateHosts `
-isolation hyperV `
-Credential $Credential `
-includeTestToolkit
#-alwaysPull `
-isolation hyperv `
#-doNotExportObjectsToText #`
-includeTestToolkit
When this script runs, it will pull the latest container image from microsoft and will overwrite any container of the same name.
It installs BC as an on-prem version but provides the server-app content via browser.
Notes:
- There must be enough disk space (approx 10GB) remaining on the drive when installing Docker and a BC container
- Switch the Docker instance to Windows Containters (found as a left-mouse-click on the Docker Desktop hidden icon (a whale)
- The *.flf file must be current
- Remember your user name and password; Docker wont