Without going into the details of Linux I’ll try and explain Docker in a few lines, this won’t be a long post.
Docker is a tool that allows you to spin up containers within seconds.
Containers can be thought of as Virtual Machines but much more lightweight and portable. They are basically miniature operating systems.
Containers are based on Images.
An Image is a file made up of multiple layers of instructions.
I came up with a poor programming analogy to help myself understand this. An Image is a Class, and the container is the instantiated object.
Docker can be run on both Linux and Windows hosts and there are now both Linux containers and windows containers.
There are quite a few benefits to using them, I’ll only mention a few to keep the read short:
Acts as a sandbox environment. You could spin up a Debian container play around in it and if you broke anything you could just throw it away and spin up a new one in seconds.
Aids in rapid and continuous deployment
Makes CI quite easy and efficient
Ensures your apps and resources are isolated and segregated
The main benefit for me is how it allows us to package up an application with all of the parts it needs, such as libraries, dependencies, and ship it as one package, and we know that it will work on whatever machine it is being run on.
Docker desktop is a pretty neat tool that allows you to spin up docker containers on your windows machine. For those of you would don’t know what Docker is I have written an article about it called what-is-docker .
To get started download and install the file from the official DockerHub site.
When asked to pick windows or linux containers, choose linux. This can be changed later.
After the install ensure virtualisation has been enabled. You can check this in the Performance tab of task manager. If this is not enabled you will need to enable it via the BIOS settings.
You will also need to have Hyper-V enabled in the Windows Features directory. (Type Windows Features in the windows search bar)
Reboot your machine.
Check docker engine is running in the icon tool tray. If it is red then you have a problem.
Execute the following to check if it is working correctly:
docker ps (there should be no containers at first, but this command should NOT fail)
Last step is to share the drives you want to be available to your containers. This can be done in the Settings menu under Shared Drives
From my personal experience I have found the tool to behave ‘unexpectedly’ at times. Whenever I changed my laptop’s password, the icon in the tool-tray would turn red. Overall though it really does make deploying web apps in containers quite interesting.