A lot of things have happened since my first blog post about getting started with Docker for Business Central, we have moved from navcontainerhelper to bccontainerhelper and we have moved from images to artifacts. So, I felt that it was about time to revisit how to use Docker for Business Central. This post is split into some subcategories so you can jump to the part that interests you.
The First part we will look at how you can get Docker up and running on your PC.
The second part we will talk about how to move from navcontainerhelper to bccontainerhelper.
The third part we will see how you can easily get started, using the New-BcContainerWizard
The finale part I will try to give some tips and tricks to make your life easier when working with Docker
Getting Docker up and running
To get Docker up and running you need to have the following setup on your PC.
1) Your PC must allow virtualization you turn this on in your BIOS
2) Next you must turn on Hyper-V in your Windows installation this is done by going to Turn on Windows Features and check off Hyper-V
3) Once you have installed Hyper-V you must Download Docker Desktop https://www.docker.com/products/docker-desktop This is done using the Next, Next, Finish, the only thing you must make sure of during the installation is that, when you are asked which type of containers you wish to run you must choose Windows
4) Once Docker is installed you should see a little whale in your taskbar, right click this icon and make sure that it says switch to Linux containers, If it instead says Switch to Windows Containers, you must choose to do so, because you must run Windows containers to create Business Central Containers.
Switch from navcontainerhelper to bccontainerhelper
If you have been running Business Central Containers in the past chances are that you have been using navcontainerhelper, and if so you must first uninstall the navcontainerhelper before installing the bccontainerhelper, to do so, open your PowerShell ISE as administrator and run the following command.
Uninstall-Module navcontainerhelper
Once this has finished go to C:\Program Files\WindowsPowerShell\Modules and if there is a folder here called navcontainerhelper delete that folder.
Next restart your PowerShell ISE as administartor and run the following script:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
install-Module bccontainerhelper
This will install bccontainerhelper, to check that everything is installed correctly go to the command panel and press refresh and search for New-BcContainerWizard, if it finds a result you are good to go.
Using New-BcContainerWizard to get started quickly
Freddy K has created a simple wizard to get you up and running with a Business Central Container all you must do is run the following command in PowerShell:
New-BcContainerWizard
This will take you through a guided setup, I will not go into more detail here since Freddys Wizzard is straight forward, the only thing that I will say is that when you get to the point where it asks what type of isolation you wish to use, I have personally had the best results using Hyper-V isolation.
Once you have completed the Wizard and it has finished successfully you should be able to access your Business Central using your browser by going to http://{containerName}/BC/?tenant=default and login with the credentials that you created doing the wizard.
Tips and Tricks
1) Do not set docker to start up with Windows, the reason is that unless you are using Docker there is no reason why it should be running, since it can take up a lot of resources.
2) Once in a while you should run the following PowerShell command:
Flush-ContainerHelperCache -cache bcartifacts -keepDays 7
This will clean up any artifacts that you have not used in the last seven days.
3) If your docker is not working try to run a system prune:
docker system prune --all –f
This will rest Docker
4) Use PowerShell ISE command panel, to search for any action that you might want to do, chances are that Freddy has created a function to help you achieve your goal.
5) Keep an eye on Freddys blog for any updates on bccontainerhelper https://freddysblog.com/
6) User PowerShell Command to Get all available versions to find the BC version that you need
Get-BCArtifactUrl -type Sandbox -country "dk" -select All
And that was it for this post, until next time stay safe. 😷