Friday, July 10, 2020

The New-BcContainerWizard! And working through Docker errors...

By Steve Endow

Have you used the new New-BcContainerWizard tool?  If not, settle in!  And I'll throw in a story about a puzzling Docker error and how Freddy helped me work through it.

Here's a video where I walk through my recent Docker learning:



Yesterday I planned on working through Erik Hougaard's video about calling an external web API from AL and processing the JSON response.  

Since I needed a new BC Docker Container to work on the demo code, I thought it would be a good opportunity to test Freddy's new BC Container Wizard tool.  So I made sure I had the latest version of NAV Container Helper, and typed New-BcContainerWizard.

The wizard is a really nifty PowerShell utility that asks you a series of questions that walk you through the different options available when using the NewBcContainer command.  After I completed the questions, it provided me with this script.

 $containerName = 'sandbox1'  
 $password = 'P@ssword'  
 $securePassword = ConvertTo-SecureString -String $password -AsPlainText -Force  
 $credential = New-Object pscredential 'admin', $securePassword  
 $auth = 'UserPassword'  
 $artifactUrl = Get-BcArtifactUrl -type 'Sandbox' -version '' -country 'us' -select 'Latest'  
 $licenseFile = 'c:\zdisks\business central\2020-06bcv16license.flf'  
 New-BcContainer `  
   -accept_eula `  
   -containerName $containerName `  
   -credential $credential `  
   -auth $auth `  
   -artifactUrl $artifactUrl `  
   -updateHosts `  
   -assignPremiumPlan `  
   -licenseFile $licenseFile `  
   -dns '192.168.25.21' `  
   -imageName 'mybc16'   
 Setup-BcContainerTestUsers -containerName $containerName -Password $credential.Password -credential $credential  

This is a really great tool.  When I first started using NavContainerHelper, it seemed very confusing and I had no idea which options to include and which values made sense for my needs.  This wizard resolves that and will be a great resource for people who are new to Docker.

Now that I had my nifty PowerShell script, I ran it.  

Sad Trombone
Sad Trombone

"This request is not supported"

Um.  What?

After a bit of googling, I eventually made my way to the NavContainerHelper GitHub repository to see if I could learn anything from the Issues list.  I saw another issue that also had "CreateComputeSystem", but the specific error was different.

So I submitted a separate issue on GitHub.  This was the first GitHub issue I've ever submitted, so I didn't know how or what to include.  I used another issue as an example, and I stumbled through the process, including what I was trying to do, a copy of my New-BcContainer script, and as much information about the error that I had available.

Freddy responded within a few hours asking for the full build log from a successful container build (excluding the imageName parameter).  I was able to attach that full build log as a text file.

Within a few minutes, he replied, explaining that the log showed I was using a very old version of windows.

The last few digits are the important ones

Sure enough, Windows Update had a few failed updates.  Those failed updates had prevented ANY updates from being applied to my server.  Once I cleared those errors and updated my server to the latest windows build, the New-BcContainer script worked successfully with the imageName parameter.

I then looked through the full container build log that I had submitted to the issue, and sure enough, there it was.

I'm talkin' to you!


Among the hundreds of lines that scrolled by during the build process, the warning was right there, showing that I had a very old Windows build and that the generic image didn't match.

While this did delay me by over a day in my AL learning process, this side adventure was very valuable, as it helped me understand a little bit more about Docker and the NavContainerHelper build process.


No comments:

Post a Comment

All comments must be reviewed and approved before being published. Your comment will not appear immediately.

Fully automate the Business Central Container build process

By Steve Endow I don't like maintenance tasks.  I don't like having to remember to do something on a regular basis.  I don't l...