What is docker? What are Containers? What can I use containers for? (NAV on Docker #3)
You have probably heard that all released Microsoft Dynamics NAV versions since NAV 2016RTM now are available as Docker images on the public Docker Hub.
If not - then you have now!
But what does that mean? What is Docker and what are Containers?
Lets start with the easy question
What is Docker?
Docker is the company driving the container movement and the only container platform provider to address every application across the hybrid cloud. It is also the name of a software handling Containers on Linux and the name of the software which handles containers on Windows.
What are Containers?
To explain containers I will start by moving back in time, back in the days in 1980 when I got my first computer (Yes, I am THAT old).
It was a Sinclair ZX 81, and it has 1Kb of RAM and 1Kb of ROM and it was an 8 bit single threaded, single processor, single kernel machine with a Z80 processor. The 1024 bytes of memory was from address 0000 - 03FF - and only one app was able to on this machine. The app owned the memory, the screen, the CPU, IO ports, etc. etc. - and then the computer was instant on (life was much easier back then).
Stay with me here... Since then, computers have gotten more and more complex and can run multiple apps at the same time - but if you think about it, every time you add an app, there are chances of conflicts. Yes we have a virtual memory manager so that one app couldn't access memory from other apps, but we really didn't get much further. If two apps wants to listen on port 80 on the public network adapter of a machine - there is a conflict and it is up the every individual app to be able to configure all kinds of things.
If two apps are having the same name and utilizing the same folder structure on the hard drive, there is a conflict and if 2 apps are using different versions of the same DLL, there might be problems. We have tried to fix this in various ways, by allowing DLL's with different versions to run side by side and to setup port sharing services etc. etc. - but the fundamental problem still exists.
When you are running an app on a computer, you stand the risk that it will conflict with everything else on the machine.
We are getting there...
With a container you achieve a higher level of isolation. Each container has its own file system, its own registry, its own network layer with its own published ports, and of course its own memory space - kind of like a virtual machine, just without the fat guest operating system. Kind of like my good old Sinclair ZX 81:-). The container is also almost instant on, when you run a container it doesn't have to perform all kind of initialization's like a normal computer. It knows that everything is right where it was a moment ago.
You can pull multiple different versions of containers, you can clone containers and you can run multiple instances of containers side by side and every container will think that it is alone in the world. Every container can listen on port 80 on the container but you will of course run into a conflict if you ask two container to expose the same port publicly on the host.
2 kinds of isolation when running containers!
As if this wasn't enough, I also need to tell you can run a container in two different ways:
Windows Server containers – multiple container instances can run concurrently on a host, with isolation provided through namespace, resource control, and process isolation technologies. Windows Server containers share the same kernel with the host, as well as each other. A Windows Server Container will only allocate memory as needed and you can specify the max. amount of memory every container can allocate. By default every Windows Server container can allocate all memory available on the host (no max.)
Hyper-V containers – multiple container instances can run concurrently on a host; however, each container runs inside of a special virtual machine. This provides kernel level isolation between each Hyper-V container and the container host. A Hyper-V container allocates the amount of memory given at startup and cannot exceed this amount. By default Windows 10 will give each container 1Gb of memory which isn't enough for the NAV Container.
Windows 10 currently only supports Hyper-V containers and Windows Server 2016 supports both. Specify --isolation=hyperv to the docker run command on Windows Server 2016 to run the container as a Hyper-V container.
The image on the right hand side really refers to Windows Server containers and I recommend you to run Windows Server 2016 if you want to run multiple containers on your host.
What can you use containers for?
Well, that is a good question and I really would like to ask you that question? I have a lot of use case scenarios (requirements from partners just like you) and we have built out the images to support these, but please follow the blog posts and please share with us what you would like to use the containers for.
What we have provided is basically the ability to configure and run NAV in a container in a homogeneous setup, which causes a lot of infrastructure issues to disappear and allow you to run many containers side by side without any issues.
Enjoy
Freddy Kristiansen
Technical Evangelist
Comments
- Anonymous
October 31, 2017
That is awesome - my first computer was also a ZX-81! I had the 16MB extended memory pack, but you had to type very carefully or the connection to the RAM would come loose and crash the machine.%kind of like a virtual machine, just without the fat guest operating systemI was under the impression that the NAV 2018 Docker image has Windows Server 2016 Core as its base. Are you saying there is a way in docker to skip the OS part and just have applications and services?- Anonymous
October 31, 2017
The NAV Docker image is based on WindowsServerCore, which is more like a foundation than an operating system. If you are running Windows Server 2016, then the servercore is really more like an integration/isolation layer than an operating system. So to your question - yes, run Windows Server 2016 and you are basically running the apps and services.trydocker run -it microsoft/windowsservercore cmdand see how much memory that consumes on windows server 2016 vs. windows 10.
- Anonymous