Before you read anything, please understand that NavContainerHelper is still available in the PowerShell gallery and it will still be available for the foreseeable future. Existing pipelines using NavContainerHelper can continue running – no problem just yet.
Future innovations and changes to support future versions of Business Central might require you to switch to BcContainerHelper. BcContainerHelper is another PowerShell module available in the PowerShell Gallery here: https://www.powershellgallery.com/packages/BcContainerHelper.
BcContainerHelper is a replacement for NavContainerHelper. Although you can install both modules side by side, the function names will clash and you will only get yourself into problems. Both modules contain the same functions and BcContainerHelper can do the same things as NavContainerHelper.
Why the change then?
Beside the obvious reason, that the product is called Business Central and not NAV, there are a few other reasons why I wanted to start a new module in the PowerShell Gallery.
Stability
NavContainerHelper is widely used and pipelines all over the world rely on NavContainerHelper not to fail. I do have a lot of tests running with every release of the module, but things can go wrong and 3 weeks ago I shipped a version called 0.7.0.12 which would have broken every single Business Central pipeline based on NavContainerHelper if I hadn’t released a fix within 45 minutes. 80 pipelines/people managed to download the faulty version before a new version was available.
At that time I realized that I had to find a way to have a stable and an insider version of the containerhelper.
The insider (preview) should be used by people who work closely with docker and pipelines, people who want to have the latest and greatest and people who want to contribute to the functionality, performance and stability of the module.
The stable version should be used by everyone else. Ideally the insider could break occasionally and the stable would never.
In order to start submitting prereleases I needed a different versioning schema. As explained in this blog post, I needed to shift to SemVer 1.0.
Directory change
A frequent feature request I have received is the ability to control where the module will place its files. NavContainerHelper is hardcoded to c:\programdata\navcontainerhelper and as you can imagine, changing this could cause some disruption. With BcContainerHelper the default location of the work directory becomes c:\programdata\bccontainerhelper but I have also added a way to modify the location of the caches and shared folders/files. Adding this to NavContainerHelper was a bit scary and I decided to do this with the move to BcContainerHelper.
Artifacts
It was important to have the change to artifacts done before the rename. Primary reason for this is, that people can stay on the latest NavContainerHelper until they have to move due to functionality they need. Development and PRs to NavContainerHelper has stopped and only bug fixes to keep pipelines running will be approved.
NavContainerHelper will stay for people finding things on blogs and trying things out. In a future version I will add an information stating that people should move to BcContainerHelper in order to
BcContainerHelper 1.0.0 has been shipped with exactly the same functionality as NavContainerHelper 0.7.0.21. New features will ONLY be added to BcContainerHelper and 1.0.2 is shipped now with terminology changes to use Bc instead of Nav where it makes sense.
NavContainerHelper will from now only get bug fixes and not all bug fixes. Only bug fixes which are blocking for people who for some reason cannot move to BcContainerHelper yet.
While writing this blog post version 1.0.2 is the latest build and insider builds of BcContainerHelper 1.0.3 are being deployed with every successful build (CD) with a prerelease tag/build number and any bug fix will be available as soon as it has been checked in the containerhelper pipeline.
Getting the latest BcContainerHelper
Like with NavContainerHelper, installing the latest version is easy
Install-Module BcContainerHelper -force
should give you the latest stable version of BcContainerHelper (1.0.0 while writing this blog post).
Install-Module BcContainerHelper -force -allowPrerelease
should give you the latest prerelease version (1.0.1-preview143 while starting to write this blog post)
If PowerShell tells you that -allowPrerelease isn’t a known parameter, you will need to update your version of PowerShellGet. You should be able to do that using:
Install-Module -Name PowerShellGet -Repository PSGallery -Force
Differences
A few things have changed between NavContainerHelper and BcContainerHelper. The obvious ones are the folders and the configuration variable. As already stated, BcContainerHelper uses c:\programdata\bccontainerhelper and NavContainerHelper uses c:\programdata\navcontainerhelper.
NOTE: I think it is possible to have both modules loaded at the same time using the allowclobber switch, but I strongly recommend that you remove all containers and uninstall navcontainerhelper before installing bccontainerhelper (remember to restart PowerShell after uninstalling NavContainerHelper)
BcContainerHelper does however support that you place a file called BcContainerHelper.config.json in the above folder, where you can point out which folder to use for cache and shared folders.
The two lines in the config file looks like:
{ "hostHelperFolder": "d:\\containerhelper", "containerHelperFolder": "c:\\programdata\\bccontainerhelper" }
If you set both values to c:\\programdata\\navcontainerhelper the module will use the data from the NavContainerHelper, I don’t recomment this.
NOTE: You should not make the switch from NavContainerHelper to BcContainerHelper while you have containers running.
NOTE: This does require the prerelease builds as 1.0.0 didn’t fully support this yet, and there might be issues with this (I found a few)
The configuration variable is called $bcContainerHelperConfig instead of $navContainerHelperConfig. Through this variable you can get access to configuration and also set configurations for this session.
NOTE: Changing the hostHelperFolder and containerHelperFolder at runtime through this variable is not supported.
Sandbox containers are multitenant by default
A bigger change with BcContainerHelper is that sandbox containers becomes multitenant by default. You can still specify -multitenant:$false if you want them to run single tenancy but since Business Central online is multitenant and sandbox containers main purpose is to emulate Business Central online, I decided that this change was necessary.
If you do not want this behavior, you can set $bcContainerHelperConfig.sandboxContainersAreMultitenantByDefault = $false.
The navcontainerhelper github repository
The github repository for the ContainerHelper has not changed and is likely not to. The master branch is the branch for BcContainerHelper and a release branch for NavContainerHelper has been created.
The master branch
https://github.com/microsoft/navcontainerhelper is the source for BcContainerHelper and all successful builds from this branch will result in a prerelease on PowerShell Gallery.
The dev branch
Is a branch I use for development purposes, for experimental features etc. Beside this there will be feature branches for various development areas.
The NavContainerHelper branch
https://github.com/microsoft/navcontainerhelper/tree/NavContainerHelper is now the source branch for NavContainerHelper.
More tests
I do have a backlog of tests to write to ensure stability of the BcContainerHelper module, those will be written over the next weeks/months.
Enjoy
Freddy Kristiansen
Technical Evangelist
Hey Freddy, great post!
You stated that in order to not have multitenancy by default in sandbox containers we would have to set $bcContainerHelperConfig.sandboxContainersAreMultitenantByDefault to $true.
Wouldn’t it make more sense if we would have to set it to $false?
LikeLike
Absolutely – I have modified the blog post, thanks.
LikeLiked by 1 person
Hi,
I have created a container using BCContainerhelper with Multitenant as False. But after completing the installation when i open the web client am getting below error.
“You cannot sign in due to a technical issue. Contact your system administrator.”
LikeLike
Please create issues on https://www.github.com/microsoft/navcontainerhelper/issues and follow the template (full script and full output) + the event log (get-bccontainereventlog)
LikeLike
Hi Freddy, thanks for your fantasitic posts. 🙂
I have tried to UnInstall the old NavContainerHelper module, before installing the new BcContainerHelper module, but I get some errors. “PackageManagement\Install-Package : The following commands are already available on this system:’Add-FontsToBCContainer,Backup-BCContainerDatabas….”
I can add -AllowClobber as parameter, but i think there must be antoher way around to complete uinstall the old navcontainerhelper module.
LikeLike
You probably need to restart PowerShell after uninstalling NavContainerHelper
LikeLike
Thanks for quick reply.
I have restarted my PC without success.
LikeLike
I think i found the problem. I need to Uninstall-Module ervery version og the old navcontainermodule…
LikeLike
Try “Uninstall-Module navcontainerhelper -AllVersions” it worked for me.
LikeLike
To Get Rid of the module – took a while to google it
$Module = Get-Module NavContainerHelper
Remove-Module $Module.Name
Remove-Item $Module.ModuleBase -Recurse -Force
LikeLike
UnInstall-Module NavContainerHelper -allversions
Followed by a restart of PowerShell is easier:-)
LikeLike
hi Freddy
I started using artifacts about a month ago and ever since then my laptop has the ghostly “Activate Windows” in the bottom right. Do I need to do something when downloading the win10 image I’m using? Do i need to run something to activate the image OS?
thanks
Ercan
LikeLike
I think this problem was resolved shortly after this. Sorry for the delay
LikeLike
Hi Freddy, I just found out today that the http://aka.ms/bcdockerscript script won’t run without BcContainerHelper. However, I can’t install a v14 Container. It looks like the artifact Url is not returning.
For example:
Get-BCArtifactUrl -version 14.5 -country us -select Latest
This returns nothing. I can try:
Get-BCArtifactUrl -type OnPrem -version 14.15 -country w1
And this returns results.
How do I specify the latest v14 sandbox for the us localization?
LikeLike
That isn’t related to BcContainerHelper. NavContainerHelper and BcContainerHelper uses the same artifacts. Sandbox artifacts is for emulating online environments and we do not have any online environments on 14.x anymore, therefore – no artifacts.
Other sandbox artifacts will also be removed as customers are upgraded.
On premises artifacts might also be removed when a version goes out of support.
You can still run docker if you have the dvd.
LikeLike
Thanks, Freddy!
LikeLike
Pingback: BcContainerHelper | Pardaan.com
Pingback: Using DevOps Agent for prepping your Docker Images
Pingback: Using DevOps Agent for prepping your Docker Images - Waldo's Blog - Dynamics 365 Business Central/NAV User Group - Dynamics User Group
On “Sandbox containers are multitenant by default”
1. This caused an error that in the event viewer of the docker tells me that it’s because it is multi tenant, that I need to define a default tenant. However, I couldn’t find out how to actually resolve that issue and define the default tenant. Tried re-rolling images and got stuck in the same state each time. Some times I could log in and be hit with a “this is a 30 day trial from microsoft”, other times I couldn’t do that at all.
2. I then used http://aka.ms/getbc to create a new azure vm, figuring I created bad data somewhere that caused this continuously, and found it still uses nav container helper, and then everything worked, likely because it’s not multitenant.
So my questions:
1. How do I set the default tenant?
2. At what point will the getbc link create azure vms with the bc container helper?
LikeLike
Please use https://www.github.com/microsoft/navcontainerhelper/issues for issues.
The link on the desktop contains ?tenant=default in the URL, that is how you set the tenant.
adding -multitenant:$false to the command will create a single tenant container where you don’t have to specify the tenant.
aka.ms/getbc will be updated to use bccontainerhelper within the next 1-2 weeks.
note that NavContainerHelper still works as it has done for quite some time
LikeLike
Pingback: ArcherPoint Dynamics NAV Business Central Developer Digest - vol 307 - Microsoft Dynamics NAV Community
Pingback: Dynamics 365 Business Central Sandbox Docker containers and multitenancy - Stefano Demiliani's NAV Blog - Dynamics 365 Business Central/NAV User Group - Dynamics User Group
Pingback: Dynamics 365 Business Central Sandbox Docker containers and multitenancy - 365 Community
Hi Freddy,
on navcontainerhelper we used the parameter assignPremiumPlan for creating bc containers and enabling the service and manufacturing part.
I couldn’t find anything similar for function run-alpipeline or do I miss something?
LikeLike
Sorry, I didn’t see this. Please create an issue on https://github.com/microsoft/navcontainerhelper/issues and include as much information as possible if this is still an issue
LikeLike
Hi Freddy,
Can you provide more info on the two parameters in the config file?
hostHelperFolder
containerHelperFolder
I have Docker configured to run on D:\, and I’m interested in having artifacts and other large files saved to D:\ as well. Would either of these config parameters help with that?
For example, can I move C:\bcartifacts.cache to the D:\ drive?
LikeLike
Ensure you have no running containers.
Create a file named c:\programdata\bccontainerhelper\bccontainerhelperconfig.json with this content:
{
“bcartifactsCacheFolder”: “d:\\bcartifacts.cache”,
“hostHelperFolder”: “d:\\BcContainerHelper”
}
Then that file should be the only file in use on the c: drive.
Cache is moved to d: bcartifacts.cache
all content normally created in c:\programdata\bccontainerhelper will now go to d:\bccontainerhelper
LikeLike
Pingback: BcContainerHelper configuration | Freddys blog
Pingback: BcContainerHelper configuration - Freddy's Blog - Dynamics 365 Business Central/NAV User Group - Dynamics User Group
Pingback: Roadmap to Artifacts .. Installing Docker..Importing Module BCContainerHelper ..Downloading Artifacts – Tanya Kharbanda
Pingback: How to Get Translation Files From Base App - Business Central Deep Dive
Hi Freddy, I have containers in programdata\bccontainerhelper, but the docker inspect on a container gives me a path to the navcontainerhelper. This results in several functions to malfunction, including Get-BcContainerSharedFolders, Get-BcContainerPath, and Import-navContainerLicense. I have tried to stop the container or even docker and change the docker container hostconfig.json and config.v2.json files, but my changes won’t persist and it changes back to the default navcontainerhelper values as soon as I start the container again.
Is there a remedy for this? Can I remap the shared folders to baccontainerhelper somehow?
Or as a work around could the hosthelperfolder be specified per container?
LikeLike
Before switching from NavContainerHelper to BcContainerHelper you should remove all containers.
In general, you should not try to keep containers running – you should keep the script to recreate them instead.
If you are in need, you can remove all containers created with BcContainerHelper and then change the HostHelperFolder to point to c:\programdata\NavContainerHelper (see https://freddysblog.com/2020/10/10/bccontainerhelper-configuration/) and then restart PowerShell – that should also work
LikeLiked by 1 person
Thank you for providing this tool. For those of us who don’t use powershell and just follow package authors instructions. it would be very useful to link or have a post about how to remove NavContainerHelper. I did try the obvious Remove-Module -Name “NavContainerHelper” which did nothing.
LikeLike
Uninstall-module navcontainerhelper -allversions
followed by a restart of PowerShell.
Remove-Module just removes a module from memory.
LikeLike
Apologies, I had missed the comment suggesting the command UnInstall-Module NavContainerHelper -allversions, with powershell restart.
So for me to switch the process was.
Start PowerShell (As administrator, although this may not be needed)
UnInstall-Module NavContainerHelper -allversions
Restart PowerShell (again as administrator)
Install-Module BcContainerHelper
All appears good now thank you for the tool.
LikeLike
Pingback: Removing all specific NAV and Business Central Docker Images | Freddys blog
Pingback: Removing all specific NAV and Business Central Docker Images - Freddy's Blog - Dynamics 365 Business Central/NAV User Group - Dynamics User Group
hey Freddy, Had a question about a specific task I need to accomplish. I want to run an msi within bccontainer. Two rar files I have need to be added to the container, un-rared using winrar, and then run using the msiexe. I was thinking of utilizing the Invoke-ScriptInBcContainer cmdlet. Do you happen to have any suggestions?
thanks!
LikeLike
The rar files would be pulled from an azure blobstorage account so the azcopy module will also need to be added to the container as well.
LikeLike
If the .msi is rar’ed, then I would do the download and unpack on the host – and then share the msi file with the container – and then run
start-process $MsiPath -ArgumentList “/quiet /qn /passive” -Wait
inside a Invoke-ScriptInBcContainer.
If the .msi is NOT rar’ed – then you can use
InstallPrerequisite
inside a Invoke-ScriptInBcContainer
Parameters: name, msiPath and msiUrl
(You can see the code here: https://github.com/microsoft/nav-docker/blob/4cc9e11fc6da15f5aecbdfa34eddf994ed85d4e1/generic/Run/HelperFunctions.ps1#L591)
Please use issues on github instead of comments on blogs, Thanks.
LikeLike
Pingback: DLLs in Docker? (BC On Prem) - Business Central Geek