Closed dvlprlife closed 5 months ago
I am experiencing the same issue.
$containerName = 'MyContainerName'
$artifactURL = Get-BCArtifactUrl `
-country "na" `
-select closest `
-type onprem `
-version "15.3.40074.40822"
$credential = New-Object pscredential 'administrator', (ConvertTo-SecureString -string 'pass@word1' -AsPlainText -Force)
$licensePath = (Split-Path $PSScriptRoot -Parent) + '\Docker Setup\xxxxxx.flf'
Write-Host $licensePath
Write-Host $artifactURL
d:
cd $PSScriptRoot
Measure-Command{
New-BcContainer $containerName `
-accept_eula `
-accept_outdated `
-memory '8g' `
-artifactUrl $artifactURL `
-updatehosts `
-auth navuserpassword `
-credential $credential `
-License $License
}
D:\repos\reponame\BusinessCentralExtensions\Docker Setup\#####.flf
https://bcartifacts.azureedge.net/onprem/15.3.40074.40822/na
BcContainerHelper is version 6.0.12
BcContainerHelper is running as administrator
HyperV is Enabled
UsePsSession is True
UsePwshForBc24 is True
Host is Microsoft Windows 10 Enterprise - 10.0.19045.4170
Docker Client Version is 25.0.3
Docker Server Version is 25.0.3
Removing Desktop shortcuts
Fetching all docker images
Fetching all docker volumes
INFO: Windows 10 21H1/21H2 images are not yet available, using 2004 as these are found to work better than 20H2 on 21H1/21H2
Pulling image
New-BcContainer Telemetry Correlation Id: 6452b076-d67b-4bdc-ad87-4fbf67df597d
DockerDo : Cannot bind argument to parameter 'imageName' because it is an empty string.
At C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\6.0.12\ContainerHandling\New-NavContainer.ps1:804 char:47
+ DockerDo -command pull -imageName $bestImageName | Out-Nu ...
+ ~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [DockerDo], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,DockerDo
After a little troubleshooting, I found that my BcContainerHelper.config.json genericImageName setting had a value of
"genericImageName": "mcr.microsoft.com/businesscentral:{0}"
The Get-BestBcContainerImageName script does a string replace, but it is looking for {1} instead of {0}
if ($filesOnly) {
$genericImageNameSetting = $bcContainerHelperConfig.genericImageNameFilesOnly.Replace('{1}', $ltscVersion)
}
else {
$genericImageNameSetting = $bcContainerHelperConfig.genericImageName.Replace('{1}', $ltscVersion)
}
I replaced the {0} with {1} and the container image mcr.microsoft.com/businesscentral:ltsc2019 was found and downloaded.
Thanks for that investigation - I can indeed see that if you have an old configuration for GenericImageName - this will happen.
The {0} is actually replaced with the Windows version and {1} is replaced with ltsc2016, ltsc2019 and ltsc2022. But... - since most Windows specific versions are no longer there - it does make sense to remove this special behavior in ContainerHelper and always go for ltsc2016, ltsc2019 and ltsc2022.
Thanks
Thank you!!! Adjusting/removing the BcContainerHelper.config file resolved the error.
Might be unrelated but after manually applying the fix from #3455 and attempting to build my usual container, I now get the error DockerDo : docker: Error response from daemon: hcs::CreateComputeSystem 5ef19c60195c2c806376f058e70b1d44f2899f1e105b909ca6f366c4ca2b9e30: The container operating system does not match the host operating system.
Seems to be because of using process isolation, using hyper-v works but consumes a total ou about ~6GB of RAM which is the reason I always go for process isolation.
To me it seems that the problem lies in the container OS version, which defaulted to ltsc2019 (I can´t remember the one used before this) which appears to be incompatible with my OS version: 10.0.19045.4170 (22H2).
Earlier, I used a 2004 container OS image, which was available to me. I was politely asked to remove these (and all other old and voulnerable images), leaving us with only ltsc streams: ltsc2016, ltsc2019 and ltsc2022.
Using Windows 11, Windows Server 2019 or Windows Server 2022 - you will be able to use process isolation.
You can also build the generic image for 2004 yourself, by cloning https://github.com/microsoft/nav-docker and running the build.ps1 script in the generic folder. This will build mygeneric:latest on your machine for the version you specify - and you would have to specify that in your settings file or in the useGenericImageName parameter.
My bad, I understand that this happened because today I updated BcContainerHelper from 6.0.5 to 6.0.12, which at some point started using only ltsc versions. I will update to windows 11 where microsoft states it is possible to use process isolation with different build numbers, if not I will try you solution.
Right you are - but please note that 6.0.5 will try to use images, which don't exist anymore - so that is no longer an option.
I am experiencing this same issue. I uninstalled the BcContainerHelper module and reinstalled the latest version. Likewise I am trying to create an OnPrem image on my Win10 workstation and get that error. I looked for a BcContainerHelper.config.json
file, but I'm finding no such file. Not sure what is going on here.
$containerName = 'devserver'
$credential = Get-Credential -Message 'Using Windows authentication. Please enter your Windows credentials for the host computer.'
$auth = 'Windows'
$artifactUrl = Get-BcArtifactUrl -type 'OnPrem' -country 'us' -version 23 -select 'Latest'
New-BcContainer `
-accept_eula `
-containerName $containerName `
-auth $auth `
-artifactUrl $artifactUrl `
-runSandboxAsOnPrem `
-isolation hyperv `
-includeTestToolkit `
-includeTestFrameworkOnly `
-memoryLimit 4G `
-updateHosts `
-credential $credential
When I run it, I get the following
BcContainerHelper is version 6.0.3
BcContainerHelper is not running as administrator
UsePsSession is True
Host is Microsoft Windows 10 Pro - 10.0.19045.4291
Docker Client Version is 25.0.3
Docker Server Version is 25.0.3
Removing Desktop shortcuts
Fetching all docker images
Fetching all docker volumes
INFO: Windows 10 21H1/21H2 images are not yet available, using 2004 as these are found to work better than 20H2 on 21H1/21H2
Pulling image
New-BcContainer Telemetry Correlation Id: fdf64d1c-9021-412e-a713-e249ec906e26
DockerDo : Cannot bind argument to parameter 'imageName' because it is an empty string.
At C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\6.0.3\ContainerHandling\New-NavContainer.ps1:800 char:47
+ DockerDo -command pull -imageName $bestImageName | Out-Nu ...
+ ~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [DockerDo], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,DockerDo
6.0.3 is definitely not the latest BcContainerHelper. You probably need to restart PowerShell after upgrading. And the problem here seems to be an old BcContainerHelper.
Yeah, I didn't realize I needed to close/reopen the ISE after updating the module. That fixed it.
PLEASE DO NOT INCLUDE ANY PASSWORDS OR TOKENS IN YOUR ISSUE!!!
Describe the issue When creating a container using an error referencing the image name appears:
DockerDo : Cannot bind argument to parameter 'imageName' because it is an empty string. At C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\6.0.12\ContainerHandling\New-NavContainer.ps1:804 char:47
Scripts used to create container and cause the issue
Full output of scripts
Additional context The error appears anytime I attempt to create a container (for any version of BC or NAV). I had no issues prior to a few days ago
I uninstalled docker completely (https://docs.docker.com/desktop/uninstall/) and rebooted several times in the process I uninstalled BCContainerHelper and Reinstalled in - Uninstall-Module BCContainerHelper Install-Module BcContainerHelper -force
Installed DockerEngine (https://github.com/microsoft/nav-arm-templates/blob/master/InstallOrUpdateDockerEngine.ps1)
I tried passing the imagename parameter (referencing Freddy's post Fairly big change rolling out on #MsDyn365BC on Docker!!!) and was not able to create a container