Moving your old dusty c/side dev environment to docker

The time has come, we can finally run multiple NAV versions, cu’s and localization’s side by side with Docker, but how do we actually move our old and dusty c/side development environment to a modern place?

I assume you already have Docker for windows up and running and the NavContainerHelper PowerShell module installed, if not there are plenty of blog posts out there to get it up and running.

Before we get started you require a bak file of the database you want to move to the Docker container and your development license in a folder so we can share it with the container.

Setting up the variables:

$PlainTextPw = "****"
$DockerImageName = "microsoft/dynamics-nav:2017-cu8-nl"
$LicenseFile = "C:\temp\DEV2018.flf"
$BakFile = "c:\temp\nav2017.bak"
$AdditionalParameters = @("-v c:\temp:c:\temp","--env bakfile=$BakFile",)

The New-NavContainer cmdlet we will call in a bit has a parameter called ‘AdditionalParameters’,
AdditionalParameters is an array containing parameters which will be passed to the docker run command which is inside the New-NavContainer cmdlet.
This way we can specify parameters which are supported by the docker scripts but are not part of the New-NavContainer cmdlet.

Note that the first parameter in $AdditionalParameters maps the c:\temp folder on the host to the c:\temp folder of the container, this way we’re sure the bak file and the license file are accessible by the powershell scripts triggered by the docker run command.

Authentication considerations:
You can either use Windows or NavUserPassword authentication, Windows is, of course the easiest, however if you’re inside a company network and you’d like your container to also work outside of your company network, you should definitely use NavUserPassword authentication!

Call the New-NavContainer cmdlet:

$Credential = New-Object -TypeName PSCredential -ArgumentList $env:USERNAME,(ConvertTo-SecureString -String $PlainTextPw -AsPlainText -Force)
New-NavContainer `
-accept_eula `
-containerName "nav2017-dev"`
-imageName $DockerImageName `
-licenseFile $LicenseFile `
-auth NavUserPassword `
-Credential $Credential `
-memoryLimit "4G"`
-includeCSide `
-doNotExportObjectsToText `
-additionalParameters $AdditionalParameters

Note: you can omit the -Credential parameter and let powershell prompt for credentials.

Within a few minutes you’ll have your “modern” c/side environment up and running, you can find shortcuts to the rtc, webclient and dev environment on your desktop.
If you’re starting finsql on a fresh machine, you might run into an ODBC error or that a certain dll is missing, if so please follow the steps described here ‘You cannot connect to the classic development environment’


Leave a Reply

Your email address will not be published / Required fields are marked *