How I do Docker

Image result for docker

I had quite a few conversations about Docker this past week at Directions. And in every conversation, I basically said that my Docker usage is done with one-liners. So perhaps it would be smart to list all my one-liners. So here goes:

To install Docker for Windows on my Windows 10 PC, I use Chocolatey – with this simple PowerShell command:

choco install Docker-desktop

If you’re not using Chocolatey, then you can download from here and run the installer manually.

Then you need to install the brilliant NavContainerHelper with another PowerShell one-liner:

install-module navcontainerhelper -force

Now we’re ready to create a Docker container. You can use the New-NavContatinerWizard to get your first container up and running.


You can also write your own New-NavContainer statement. Warning: This is a one-liner, but it’s a long one, you better put it in a .ps1 file, instead of copy’paste directly to a PowerShell prompt.

New-NavContainer -accept_eula -alwaysPull -imageName "microsoft/bcsandbox:dk" -containerName bcsandbox -licenseFile 'C:\license\my2018.flf' -memoryLimit 4G -updateHosts -shortcuts Desktop -includeCSide -assignPremiumPlan -auth NavUserPassword -myScripts @{"AdditionalOutput.ps1" = 'Copy-Item -Path (Join-Path $roleTailoredClientFolder "*office*.dll") -Destination (Join-Path $serviceTierFolder "Add-ins\Office")'}

Since this is quite a long command, let me break it down into the important parameters:

accept_eula Because where’s the fun without an EndUserLicenseAgreement to accept
alwaysPull Make sure you have the latest version of the image from Microsoft.
imageName What image your container should be based on.
-containerName This is the “computer name” your container will get. This is the name you can PING, this is the name you’ll use in the browser address bar and in Visual Studio Code to access the container.
licenseFile An URL or direct file path to an FLF license file to be imported to the container.
memoryLimit Limit the memory used by the container.
updateHosts Update the hosts file with an entry for the imageName.
shortCuts Create shortcuts for access to the container.
includeCSide Because we still need CSide
assignPremiumPlan Hey, I need a Premium experience
auth NavUserPassword Create a NavUserPassword access. The first thing happening is a prompt to enter a user and password. It looks like it’s asking for you login, but the dialogue is actually asking for a user and password combo.

The last command is just something I need because some Office DLLs are missing in the add-ins folder (to be available for DotNet), you properly don’t need it unless you’re using DotNet like me:
myScripts @{“AdditionalOutput.ps1” = ‘Copy-Item -Path (Join-Path $roleTailoredClientFolder “*office*.dll”) -Destination (Join-Path $serviceTierFolder “Add-ins\Office”)’}

Speaking of DotNet, sometimes I need to add extra DotNet DLLs, that’s done with this one-liner:

Copy-FileToNavContainer -localPath c:\DLLs\*.dll -containerPath "C:\Program Files\Microsoft Dynamics NAV0\Service\Add-ins" -containerName bcsandbox

Again a great feature of NavContainerHelper, simply copies files from my local machine into the container.

Sometimes,  I need to restart the container, also done with NavContainerHelper:

Restart-NavContainer -containerName bcsandbox

Hope this helps a bit to lean but great Docker and Business Central/NAV experience.