I have been struggling in getting my head around managing “stuff” on Docker. You know – the new kid in town that will see its use in many fields. We implemented a Docker-based environment for Build-server, for local dev, and now also for test servers for customers. And as you know – you can use is for much more!
In any case, you need docker “somewhere”. Some people install it on their Windows 10 – but that would be something I would never recommend, because in my opinion, it belongs on a “server”, simply because the memory management is much better and all that.. .
You are probably familiar with AJ’s blogpost on how to setup a nice local Docker Environment based on a Windows Core in a Hyper-V. I find it the ideal way to work with docker images locally, to be used for local development, testing, previewing, … you know .. a flexible and clean way to manage many different builds of Dynamics NAV.
You are also quite familiar with the navcontainerhelper, probably. I absolutely love that PowerShell module that Freddy created. It basically solves the problem to call typical Dynamics NAV cmdlets remotely. When you look at the code (it’s all available on GitHub, by the way), it’s full of “Invoke-Command”, meaning that a function in the navcontainerhelper-module executes a number of NAV cmdlets remotely on the container. It’s much easier to work with, because you avoid having to enter the container session, and execute the cmdlets one-by-one.
So, what is this new module all about then?
Well, the downside of having a windows core docker host – or any “remote” docker host for that matter – is that you still have to enter remote sessions, and execute PowerShell from there. Just consider the following scenarios:
So, in both cases – you need to log into another machine. And all I want to do is repetitive tasks time and time again.
That’s where my new module comes into play. It’s definitely not a replacement of the navcontainerhelper – in the contrary – it’s dependent on it for some tasks. But it’s one step further, for the cases you are not working on the same machine as you have installed Docker – which appear to be the majority of the times, in my case.
I created two examples. Basically for me to be able to test the module .. But also to illustrate in what way you are able to use them. All scripts where I use the module, can be found on my github in this folder here: https://github.com/waldo1001/Cloud.Ready.Software.PowerShell/tree/master/PSScripts/NAV%20Docker/RemoteDocker
You see it contains a number of folders. Each folder represents a scenario. So, it contains scripts to be run against an AzureVM (where you enabled Remote PowerShell), and the other folder “waldocorevm” works against my local VM that contains docker.
Both folders contain a _Settings.ps1, which basically contains the connection details for that specific scenario. All the other scripts in the folder, work with these settings and with the CRS.RemoteNAVDockerHostHelper-module, to do what it’s entended for.
For example if you want to test to upgrade an app, just look at the UpgradeApp.ps1 and you’ll see it’s quite simple. No remoting, nothing, just calling a “simple” powershell function from the module, and all will be done for you in the background. Here is an example of the clean-script being executed from my laptop, but is going to remove all apps on a container of my VM on Azure:
I know, nothing much exciting, but if you know it is actually “remoting” into two sessions – well – quite cool, if I may say so myself ;-). This is the clean-function from the module:
One thing worth mentioning is that it’s also going to take care about your App-file that you have on your local machine, but you might want to publish way up there in the cloud. Just look at the Copy-NAVAppToDockerHost, which is used by Install-NAVContainerAppOnDockerHost for example :-). SImple, and efficient!
Where can I get this module?
Well, the easiest is to just download it from the PowerShell Gallery, by executing:
But it is also available on my Github alongside my other modules: https://github.com/waldo1001/Cloud.Ready.Software.PowerShell
Any feedback is useful! If you want me to address specific things, most convenient is to provide feedback on github. But on this blog is fine as well ;-). You are always welcome to fork into the project like many other already have done, by the way :-).
If you would like to read up on remote powershell, well, there is a lot of info out there. Just a few examples which were useful for me: