Breaking news from around the world
Get the Bing + MSN extension
Now Available in Community - MBAS 2019 Presentation Videos
Catch the most popular sessions on demand and learn how Dynamics 365, Power BI, PowerApps, Microsoft Flow, and Excel are powering major transformations around the globe. | View Gallery
2019 release wave 2 Discover the latest updates to Dynamics 365Release overview guides and videos Release Plan | Early Access Availability
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Talent TechTalks | Upcoming TechTalks
If you stumbled upon this blog post you probably know what Docker is and wondering could it be useful when developing for Dynamics 365 Business Central. The short answer is yes. Let’s talk why and then I will tell you how to set it up and share a few great tips when using it.
First of all, why should you use Docker? Well, it’s really useful for testing, experimenting and working in teams. Moreover, you can make Docker container accessible to your whole network, or even beyond that. Docker containers are great since you can create them within minutes, and they would be setup and ready to go, so if you mess up your database you can always recreate it in a heartbeat. You can recreate the standard database, or a custom database using a .bak file. Docker gives you true sandbox experience where you don’t need to worry about services each time you need a new database to play with. There are some drawbacks, but the advantages outweigh them.
To use all its advantages you first need to install Docker, depending on where you want to install it (Windows 10 or Windows server) you need to approach it differently. For Windows server, there are just a few commands to achieve it, for Windows 10 you need to sign up on official Docker web page and download install, but before that, you need to setup your computer.
Make sure that your computer supports Virtualization technology. Turn virtualization technology in your bios, when computer boot’s up turn Hyper-V feature on.
Installing Docker on Windows 10: Sign up and download Docker install https://www.docker.com/. Follow installation instructions. Make sure that Docker is setup to run Windows containers.
Installing Docker on Windows server: open PowerShell as administrator and type in commands Install-Module DockerMsftProvier –Force and then second command Install-Package Docker –ProviderName DockerMsftProvider –Force.
Next, we would really recommend you to use NavContainerHelper, this goes for both Windows and Windows server users. NavContainerHelper is a set of scripts designed to help you setup and manages Business Central Docker containers. To install it enable scripts on your machine.
To enable scripts type in the command in PowerShell opened as administrator: Set-Executionpolicy RemoteSigned
Moving on, type in a command to install NavContainerHelper: Install-Module NavContainerHelper –Force then use command Get-Command –Module NavContainerHelper to check if it installed correctly and to get a list of all commands possible with this module use command Write-NavContainerHelperWelcomeText we recommend copying list of commands and storing it in an easily accessible location.
We would also recommend creating a template for New-NavContainer command so that you won’t have to go online and check all the possible parameters for that command.
Before you run and start creating new containers you might want to change the drive where Docker keeps it’s images and containers, to save space on your Windows drive. To change the location you need to go to Docker configuration file and add command. To access it you first need to change options of your file explorer to see hidden folders, then go to “C:\ProgramData\Docker\config” you might find “Daemon.json” file in this directory, but it is not always present. If this file does not exist then create it. Either way, you need to add a command to it: “data-root”: “D:\\docker”. If it’s a brand new file then its content should look exactly like this:
After you save this file you need to restart Docker service for changes to take effect. To make sure that your storage drive has changed, in command prompt (CMD) type in “docker info” and look for “Docker root Dir: “.
Now that you won’t waste space on your Windows driver you might want your teammate to help you out on the upcoming project. The easiest way to open container for the local network is to publish container ports. You might not be able to access the database from any other than host computer but your teammates will be able to download database symbols and will be able to publish extension to this database. There is a better way to fully open containers to the local network by creating a transparent network for Docker. If you want to learn more, you can buy Simplanova training courses.
To publish ports of container you need to first know which ports are used by NAV. Then add an additional parameter when creating a new container. This additional parameter might look something like this:
“-additionalParameters @(“–publish 8180:8080”, “–publish 81:80”,”–publish 7146-7149:7046-7049”,”–env publicFileSharePort=8080”,”–publish 444:443”)
Now, let’s analyze this parameter a bit. All additional parameters, when using NavContainerHelper commands usually are commands from base Docker, meaning that it directly controls container without touching NAV itself. There are exceptions for example when creating a database from a .bak file. Talking about ports, the port on the left is a port on your host machine, meaning, it has to be free otherwise you will get an error while creating a container. Each time you create a container with published ports you need to choose free ports. The port on the right points to ports inside the container, meaning they will always be the same, each time creating new NAV container they will stay the same.
One quick thing to note, you can always open Docker container database server using Microsoft SQL server management tool, but this tool will only see file system of the container itself, instead of host machines. So if you want, for example, restore database or maybe create database .bak file and store it for safekeeping you might want to know how to access container’s file system and how to extract files from it. Both of these actions are easy. To access containers file system you can either use one of the shortcuts created on your desktop when creating a new container or use one of few commands provided to you by NavContainerHelper or Docker itself to enter this container. Now extracting files from the container is another story. The easiest way is to use command “docker cp” this command allows you to move files in and out of the container, take note that you can always extract files from the container but when you want to put something in you first need to stop it. So the syntax for copying files from container to host machine “docker cp <container name>:<path to file directory>/file.txt /<path where you want file to appear on your local machine>” now if you want to insert file to container use the same command backward “docker cp <path to file on host machine> <container name>:<path to location in container where you want file to appear>” you can change name of file during copying process by adding to destination path new file name and type “<destination path>/NewName.Txt”. if there is already file with the same name in the destination on the container it will automatically be overwritten.
We hope this information will make the whole process a lot easier while using Docker. If you are interested in perfecting your skills in Extensions, please find more information about Simplanova Dynamics NAV Extensions Workshops here.
The post Tips and tricks for beginner Dynamics 365 Business Central Docker user appeared first on Simplanova.
Business Applications communities