Docker allows us to run applications inside containers. Running an application inside a container takes a single command: docker run or docker container run. Dockers tagline is that it's a platform for building, running and shipping applications. What the beauty of Docker is, is that if it runs on your machine it will also run on other machines. We've all been there when something runs on your infrastructure, but when you do exactly the same on a colleagues machine it doesn't work at all. There are plenty of reasons why this could be happening. For example, files might be missing, different configuration settings or the software packages that you are using have a version mismatch. These problems will be solved with Docker.
Docker will package up your whole application and all the dependencies it needs. You can then grab this package and deploy this on another machine. The tech behind this is called 'containerisation'. More about that below. But first, let's talk about virtualisation
Virtualisation is a way to create 'virtual' computing place, as opposed to a 'physical environment. What this boils down to is that it allows you to install multiple operating systems on the same machine. For example, on my Macbook Pro I also got Windows running by using a tool called 'Parallels'. This is one of a few tools that allow you to run multiple OS's without having to reboot your laptop.
Docker actually works differently and as I mentioned before, it uses containerisation. What Docker does is virtualise the operating system, not the actual hardware itself. Let's hop into a few key tools and concepts that will help you further understand Docker.
The steps involved are:
docker build -t nameofapplication .
-t is for tagging the container so it's easier to find it backdocker run -dp portOfHost:portOfContainer nameofapplication
. -d is for running in detached mode, in the background in your terminaldocker ps
docker stop <idofcontainer>
docker rm <idofcontainer>