Today many organizations and companies are following new trend in tech: Cloud. Everything, from database, to application server, or web service are totally based on cloud. Companies can host their own system on their infrastructure, or called on-premises system, but maintaining a hardware and software in parallel is a very complicated task. So they are changing to use a service which provided by many IaaS providers, to focus only on software and application without worrying about networking, security, or operating system like AWS or Azure.
However, IT guys do not offen familiar with cloud tech and tools from provider. They need to study and learn about infrastructure of each provider: configuration, setup and so on. They also need to learn about deployment as well as transferring application to the cloud as well.
So, Docker is a new solution for us to resolve the issue about transferring and deployment.
Docker is an open platform for building, shipping and running distributed applications. It gives programmers, development teams and operations engineers the common toolbox they need to take advantage of the distributed and networked nature of modern applications.
Basically, Docker is a platform, which allow us to create our own copy image of our application, ready to ship and deploy to any available system. To do it, docker wraps up our application and all dependencies, including web-server or any service you need, to a container, this container can be pushed to cloud and ready to use anywhere docker is available. Just Write one, run anywhere like Java, right? You can image Docker works like a virtual machine, while our application is virtual image and ready to run under any platform and any system.
However, it is not really a virtual machine. Here are differents:
You can see architecture of a virtual machine: based on infrastructure (hardware part), then we have an operating system called Host OS, then Virtual Machine will use a hypervisor, which act like bridge between virtual environment and host environment, allow virtual OS can use any host OS resource like disk, network and so on. From virtual machine, we can create many image which own itself operating system called Guest OS. Now onto each Guest OS, we can create and run application with libraries and executables from Guest OS. Note that in this architecture, we have two layer of operating systems which can lead to heavy load on resources. And why we need two OSes, why our applications just work depend on Guest OS only?
And here is Docker:
You can see, the Docker Engine acts like both Guest OS and Hypervisor of Virtual Machine. The engine is responsible of manage and perform needed actions which containers have. Application will run inside Docker container with every depended binaries and libraries. So when it comes to application, Docker uses resources more intelligently and more effectively.
How to use
Getting started is easy. We just need install some needed tools and we are ready to go. Let’s take a look at Docker’s Get Started guide:
- install Docker
- run a software image in a container
- browse for an image on Docker Hub
- create your own image and run it in a container
- create a Hub account and an image repository
- create an image of your own
- push your image to Hub for others to use
After finished the guide, you can have an overview about how Docker work. And now you want your real application, like a PHP app with Apache and MySQL ready to ship with, to be built and ready to deploy on any environment, from RedHat to CentOS or Windows. In next part, we will go deeply about how can we create a container from our existing application, and ship it to another operating system, then we can deploy it and make sure everything is just ready right after.