Docker explained: the solution to the “It worked on my laptop” issue
Docker is gaining a lot of traction and has been adopted by millions of companies worldwide, but what is the hype about? Docker can be a very vague concept at first, so let me break it down for you.
Table of contents
- What is Docker?
- Virtual Machines vs Docker Containers
- Docker and UbiOps
What is Docker?
Docker is an open-source containerization platform. It allows developers to deploy software in isolated environments with everything it needs, such as libraries and other dependencies. The main advantage of this is that no matter where your application runs, you can rest assured that it will behave the same. No more issues with “It worked on my laptop”!
Docker containers can be deployed on just about any machine without compatibility issues. Therefore, with the use of Docker containers, you can keep your software system agnostic. This leads to better portability and easier maintenance.
Docker containers can be seen as little microcomputers, with their own operating system, compute resources, and memory allocation. They can easily be added, removed, stopped or started again without influencing each other or the machine they are running on.
Docker is present in many different software architectures nowadays. It is for instance the go-to in microservice architectures (with Kubernetes). In addition, Docker provides an easy way for developers to ship their solutions to the cloud.
Virtual machines versus Docker containers
You might be thinking that “little microcomputers” sounds a bit like virtual machines(VMs), so what’s the difference between VMs and Docker containers?
For starters, with Docker, the resources are shared directly with the host system. Therefore it requires far fewer resources than VMs. This allows you to run many Docker containers on a single machine as opposed to only a few VMs. A VM needs a set amount of resources, like hard drive space, memory, and CPU. It does not really share these claimed resources causing it to be much heavier.
Docker uses less disk space too since it uses a layered file system to efficiently work with files. Say for instance, that you have several Docker containers for different jobs, which were all created from the same base image. Docker then keeps a single copy of the necessary files, and shares it with the different containers.
Docker containers are less isolated than VMs however. With Docker you have a lightweight option with which you can easily run hundreds of containers on a single host. With a VM you get more isolation, but at much higher costs as it requires a lot more resources.
There are advantages and disadvantages for each type of virtualized system. If you require full isolation with guaranteed resources, a full VM is the best option. If you want to isolate processes from each other, make sure they run the same for anyone, and run multiple, then Docker is the way to go.
Docker and UbiOps
When you work with UbiOps, the required Docker images for your code will be created in the background and managed by UbiOps. This way you can reap the benefits of using Docker, without having to dive into it yourself. As an added bonus the Docker containers will also be dynamically scaled in the background with the use of Kubernetes, to minimize your costs. To learn more, check: /why-do-you-hear-kubernetes-and-machine-learning-together-so-often/