microsoft/navcontainerhelper

Cannot reuse Normal image as FilesOnly Image

Closed this issue · 2 comments

Describe the issue AND Full output of scripts
If I try to create a -filesOnly Container from an image that was created with -filesOnly:$false the scripts don't start the service tier (as I want) but then complain that the service tier isn't running. It seems to happen in a call of Wait-BcContainerReady.

Are we supposed to be able to do this without wasting lots of space on another pre-built Image (or keeping a second copy of the artifacts hanging around in the cache) ?

Scripts used to create container and cause the issue

PS C:\> $username = 'NavUser'
PS C:\> $password = 'Aa123456' | ConvertTo-SecureString -asPlainText -Force
PS C:\> $credential = New-Object System.Management.Automation.PSCredential($username, $password)
PS C:\> $containerName = 'testcontainer'
PS C:\> $navimage = 'navimage:nextmajor-gb.3'
PS C:\> $isolation = $null
PS C:\> $additionalParameters = $null
PS C:\>
PS C:\> New-BCContainer `
>>     -containerName $containerName `
>>     -imagename $navimage `
>>     -accept_eula `
>>     -auth NavUserPassword `
>>     -isolation $isolation `
>>     -memoryLimit 8G `
>>     -Credential $credential `
>>     -shortcuts None `
>>     -EnableTaskScheduler:$false `
>>     -doNotCheckHealth `
>>     -filesOnly `
>>     -additionalParameters $additionalParameters
BcContainerHelper is version 6.0.17
BcContainerHelper is running as administrator
HyperV is Disabled
Host is Microsoft Windows 10 Enterprise - 10.0.19045.4291
UsePsSession is True
UsePwshForBc24 is True
UseWinRmSession is allow
UseSslForWinRmSession is True
Docker Client Version is 24.0.6
Docker Server Version is 24.0.6
Removing Desktop shortcuts
Removing C:\ProgramData\BcContainerHelper\Extensions\testcontainer
Fetching all docker images
Fetching all docker volumes
Using image navimage:nextmajor-gb.3
Disabling Health Check (always report healthy)
Creating Container testcontainer
Style: sandbox
Multitenant: No
Version: 25.0.18915.0
Platform: 25.0.18882.0
Generic Tag: 1.0.2.20
Container OS Version: 10.0.19041.1415 (2004)
Host OS Version: 10.0.19045.4291 (22H2)
WARNING: Host OS is Windows 10 21H1 or newer and Container OS is 2004, defaulting to process isolation. If you experience problems, add -isolation hyperv.
Using process isolation
Using locale en-GB
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
Additional Parameters:
--expose 5986
--env customNavSettings=EnableTaskScheduler=False
Files in C:\ProgramData\BcContainerHelper\Extensions\testcontainer\my:
- AdditionalOutput.ps1
- AdditionalSetup.ps1
- HelperFunctions.ps1
- MainLoop.ps1
- SetupVariables.ps1
- updatecontainerhosts.ps1
Creating container testcontainer from image navimage:nextmajor-gb.3
2c1a4e0f10428670b02208adc7bd71f6987a126525efede6c49217c2abfd5526
Waiting for container testcontainer to be ready
Ready for connections!
ServerInstance 'MicrosoftDynamicsNavServer$BC' is not running.

Container Free Physical Memory: 7.5Gb

Services in container testcontainer:
- MicrosoftDynamicsNavServer$BC is Stopped
- MSSQL$SQLEXPRESS is Stopped
ServerInstance 'MicrosoftDynamicsNavServer$BC' is not running.
At C:\Program
Files\WindowsPowerShell\Modules\BcContainerHelper\6.0.17\ContainerHandling\Invoke-ScriptInNavContainer.ps1:299 char:25
+                         throw $errorMessage
+                         ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (ServerInstance ...is not running.:String) [], RuntimeException
    + FullyQualifiedErrorId : ServerInstance 'MicrosoftDynamicsNavServer$BC' is not running.

PS C:\>
PS C:\>

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context

  • does it happen all the time? Yup.
  • did it use to work? Not sure; of course, I think it should have.
  • PS: No Aa123456 is not a password!

Never thought about this scenario and the time saved by this is really not worth the effort trying to make this work, when there are so many other and more important things to fix

I'd estimate it'd make the special case 5-10 times faster, but that case only applies when there are no tests to run.
So yeh, no problem.