Docker is a great solution to the several problems, such as the one of porting code and executables, and the one on installing software.
When we install software, we need a suitable environment. Just to make an example, some web apps need to have a certain version of php, others a different one. Configuring a machine with multiple versions of something (e.g. php) may be feasible but complex. Moreover, sometimes we need to install certain supporting software just to test an app, that we later decide to drop: we are left with the now unnecessary stuff we’ve installed, or with the duty to correctly uninstall it.
When we port software to a different platform, we typically encounter a number of difficulties. A Java application may need a certain version of the APIs, and we need to make sure that our customer has installed it. Sure, we can include the java distribution in the jar, but resolving dependencies is not always that straightforward.
The Docker idea is close to the virtualization concept: we can create a virtual machine, and in that create the suitable environment for our app, and install it there. Conceptually simple. However, that is not really virtualization, as Docker actually runs by reusing the kernel of the host machine – provided that is a Linux. If it is not, then there actually is a single VM running in the host, in the VM runs (only once) the Docker infrastructure that can host a number of “virtual environments” which take the form of Linux machines, and which are called “containers”. On the Mac, the docker distribution includes a VirtualBox VM which is automatically installed and run when needed. This is transparent, but has some implications (especially when working with the network layer).
Where do you start from to learn docker?
If you’re a Mac user, the right place is in the official site.
Why yet another tutorial?
There are a number of good Docker tutorials out there, especially those in the official site: the three videos (one hour each) are an excellent way to get oriented in the docker world. So why other tutorial?
Well, because not everything is immediately easy and straightforward. For instance, I had some difficulties in understanding how to install and deploy Apache in a container. Sure, I could have downloaded a ready-made image, but that would not have helped me understanding – and if you do not understand, the first problem you encounter is going to knock you out.
So I developed step-by-step examples which can be easily replicated, providing a guided learning path.
Here is the list:
- EXAMPLE OF CREATING A LINUX BOX INTO DOCKER
- MANAGING DOCKER CONTAINERS
- CREATING A LINUX BOX INTO DOCKER WITH A DOCKERFILE
- DOCKER IMAGES MANAGEMENT
- SHARING PART OF THE FILE SYSTEM WITH DOCKER
- INSTALLING APACHE2 ON DOCKER (ON A MAC) – PART 1
- INSTALLING APACHE2 ON DOCKER (ON A MAC) – PART 2: WRITING A Dockerfile
The tutorials will be made available over the next few days.