Have you ever wanted to be able to use the easy setup of navcontainerhelper to setup your infrastructure but you would like to be able to connect to a “real” database to your Docker? Well look no further, in this post I will show you how you can accomplish just this. Now just a disclaimer, this is nothing new that I have come up with, there a lot of blog posts out there that shows you how to achieve just this, but hopefully this post will show you the easiest way for you to get from point A to B. 

But why would you want to connect a Docker to a local database? Well there can be many reasons for this, one could be that you would like some real data to test your extensions on and another, which I feel is the most used reason is during upgrades, because it will save you a lot of time, not having to setup all your infrastructure when upgrading. Now some of you might be tempted to think hmm.. well if I can connect my database to a Docker, then why not run all my production infrastructure on a Docker, and while this would be possible. Microsoft does not “yet” support this, so I would recommend that you wait, until Microsoft says that it is supported.  

Well let us get started, the first thing you have to do is make sure that your SQL Server is running in mixed mode, this is done by opening your SQL Studio Management going to server properties -> security and choose SQL Server and Windows Authentication mode. 

This will allow you to connect to the SQL using both Windows and SQL user logins. Next you need to go to connections and make sure that you allow remote connections. 

Next you need to create a new SQL Login by going to logins and creating a new user and choose SQL Server Authentication, and make the user Sys admin. 

You should also open port 1433 in your firewall for inbound traffic. 

When all this is setup you are ready to create your new container and that is done with the following PowerShell script. 

$credential = Get-Credential
$dbcredentials = Get-Credential
$imageName = 'mcr.microsoft.com/businesscentral/onprem:14.7.37609.0-dk-ltsc2019'
$containerName = 'MyTest'
$DatabaseName = 'MYBC14'
$License = 'C:\License\MyLicense.flf'

New-BCContainer `
    -accept_eula `
    -containerName $containerName `
    -imageName $imageName `
    -updateHosts `
    -auth UserPassword `
    -Credential $credential `
    -databaseServer '' `
    -databaseInstance '' `
    -databaseName $DatabaseName `
    -databaseCredential $dbcredentials `
    -licenseFile $License `

New-NavContainerNavUser -containerName $containerName -Credential $credential -ChangePasswordAtNextLogOn:$false -PermissionSetId SUPER

Where you must change the -databaseServer ‘’ to your own local IP, and that is it this will create a new NAV container running on a local SQL database, enjoy 😊


My kollega Thomas Guldstrand made me aware that I missed a step which is to

Remember to enable TCP/IP in the SQL network configuration.

Leave a Reply