microsoft / navcontainerhelper

Official Microsoft repository for BcContainerHelper, a PowerShell module, which makes it easier to work with Business Central Containers on Docker.
MIT License
379 stars 243 forks source link

Cannot create BC17 Container - always switches to 16.X #1385

Closed Mkublbock closed 3 years ago

Mkublbock commented 3 years ago

I am trying to create a new Container with BC Version 17.X but it always pulls the latest image from mcr.microsoft.com/businesscentral/onprem:ltsc2019. I am using the artifacturl https://bcartifacts.azureedge.net/onprem/17.0.16993.0/at which I got from running Get-BCArtifactUrl -type OnPrem -country "at"

This is the script I am using:

New-BCContainer -accept_eula `
                -accept_outdated `
                -containerName $containerName `
                -artifactUrl https://bcartifacts.azureedge.net/onprem/17.0.16993.0/at `
                -licenseFile ".license.flf" `
                -updateHosts `
                -useSSL `
                -memoryLimit 4G 

Full output of the script:

NavContainerHelper is version 0.7.0.26
NavContainerHelper is running as administrator
Host is Microsoft  - 1909
Docker Client Version is 19.03.13
Docker Server Version is 19.03.13
Fetching all docker images
Pulling image mcr.microsoft.com/businesscentral/onprem:ltsc2019
ltsc2019: Pulling from businesscentral/onprem
Digest: sha256:067e5cc1ef71213925d4d712f8525a9f046b57f61e6c785525507d293575e1d3
Status: Image is up to date for mcr.microsoft.com/businesscentral/onprem:ltsc2019
mcr.microsoft.com/businesscentral/onprem:ltsc2019
Using image mcr.microsoft.com/businesscentral/onprem:ltsc2019
Creating Container temp
Version: 16.3.14085.14238-W1
Style: onprem
Platform: 16.0.14073.14195
Generic Tag: 0.0.9.99
Container OS Version: 10.0.17763.973 (ltsc2019)
Host OS Version: 10.0.18363.1139 (1909)
The container operating system does not match the host operating system, forcing hyperv isolation.
Using locale en-US
Using hyperv isolation
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
Using license file .license.flf
Files in C:\ProgramData\NavContainerHelper\Extensions\temp\my:
- AdditionalOutput.ps1
- license.flf
- MainLoop.ps1
- SetupVariables.ps1
- updatehosts.ps1
Creating container temp from image mcr.microsoft.com/businesscentral/onprem:ltsc2019
8ce8c7bf0857120aefd9e0bc05336dfdd6ad7c6de61fed1c20735a5854ee49f1
Waiting for container temp to be ready
Initializing...
Setting host.docker.internal to 10.8.80.237 in container hosts file (copy from host hosts file)
Setting gateway.docker.internal to 10.8.80.237 in container hosts file (copy from host hosts file)
Setting kubernetes.docker.internal to 127.0.0.1 in container hosts file (copy from host hosts file)
Setting host.containerhelper.internal to 172.18.208.1 in container hosts file
Starting Container
Hostname is temp
PublicDnsName is temp
WARNING: Container starts with TimeZone = Mitteleuropäische Zeit, which is not recognized in the list of TimeZones.
Using Windows Authentication
Starting Local SQL Server
Starting Internet Information Server
Creating Self Signed Certificate
Self Signed Certificate Thumbprint ED7F17A0182ADEEAB578AA89229B98CAA5155194
Modifying Service Tier Config File with Instance Specific Settings
Starting Service Tier
Registering event sources
Creating DotNetCore Web Server Instance
Using license file 'c:\run\my\license.flf'
Import License
Creating http download site
Creating Windows user m.kueblboeck
Setting SA Password and enabling SA
Creating SUPER user
Container IP Address: 172.18.223.157
Container Hostname  : temp
Container Dns Name  : temp
Web Client          : https://temp/BC/
Dev. Server         : https://temp
Dev. ServerInstance : BC
Setting temp to 172.18.223.157 in host hosts file

Files:
http://temp:8080/ALLanguage.vsix
http://temp:8080/certificate.cer

WARNING: You are running a container which is 249 days old.
Microsoft recommends that you always run the latest version of our containers.

Initialization took 86 seconds
Ready for connections!
Reading CustomSettings.config from temp
Creating Desktop Shortcuts for temp
Container temp successfully created

As you can see I am using the correct ArtifactURL but it will still pull the image from mcr.microsoft.com/businesscentral/onprem:ltsc2019.

freddydk commented 3 years ago

Somehow, it doesn't get your artifactUrl parameter - maybe it needs to be in " maybe you have a space after one of the ` at the end of a line.

Mkublbock commented 3 years ago

When I type

New-BCContainer -accept_eula -accept_outdated -containerName BC17 -artifactUrl https://bcartifacts.azureedge.net/onprem/17.0.16993.0/at -licenseFile "C:\Users\kueblboeck\Documents\Lizenzen\201005_5356216_DEV_BC17.flf" -updateHosts -useSSL -memoryLimit 4G

directly into powershell it works, but when I execute this script

param (
    [parameter(Mandatory=$true)]
    [String]
    $containerName,
    [parameter(Mandatory=$true)]
    [String]
    $artifactUrl
)

New-BCContainer -accept_eula -accept_outdated -containerName $containerName -artifactUrl $imageName -licenseFile ".license.flf" -updateHosts -useSSL -memoryLimit 4G 

it doesn't take artifactUrl into account - even with "" around $imageName it doesn't work. Will play with it a little bit to see if I can fix it.

Thanks for your help!

freddydk commented 3 years ago

Your parameter is called $artifactUrl and you are using $imageName in the code ($imagename is probably blank)

Mkublbock commented 3 years ago

Obviously, how have I overlooked that 🤦‍♂️