Posts

Showing posts with the label Docker

Persistent Data in Docker: Explanation + Hands-On Demo

Docker containers, by nature, are ephemeral. They are not designed to stay without being deleted for long periods of time. While you could, theoretically never delete the image, most of the benefits of docker are realized when containers are temporary. There is something wrong with this approach, though. Almost all the data in the world is designed to be persistent. This poses a problem that docker volumes can solve. What are docker volumes? Docker volumes are a method of ensuring data persistence in a containerized environment. To comply with best practices, you need to make sure that spontaneously losing a container or 2 does not have an impact on anything but the performance of your infrastructure. To do this, all the important data in your containers needs to be put somewhere. Somewhere which is not liked to the life-cycle of the container itself. That somewhere is a volume. A docker volume is little more than a place to store data. From the point of view of the container, nothing

Hands-on docker: Deploying Your First Containerized App

This post and all of it's content has been written with the assumption that you are familiar with basic Docker concepts. If you are not, or just need a review of the topic, please click here. Once you have learnt the basics of docker, I am sure you want to implement you knowledge, right? I certainly know I was. I believe the best way to learn is by doing. So let's learn Docker in the most effective way we can, by using it. ALL THE COMMANDS IN THIS WALK-THROUGH NEED TO BE RUN WITH ADMIN PRIVILEGES The first step in this process is to install docker. I am assuming you do not have docker installed. If you do, you can skip this part. The docker installation steps are quite complex and differ for every OS. You will find several OS-specific guides to install docker if you look for them. There is actually an installation guide on the docker website itself. Here is the link to it https://docs.docker.com/engine/install/ . Before we create the container, we need the image. To create the

Introduction to Docker: A Guide to Containerization

Docker, at its core, is quite basic. It is a containerization engine. But what is containerization? Containerization performs the same basic function as virtualization. It creates several virtual computers inside a single computer or server. What makes containerization different from virtualization is that it is crazy fast. Like, insanely fast. When you are provisioning a virtual machine, you might expect it to take about 5-10 minutes assuming it is an OS designed to be very light-weight. A container, on the other hand, can provision an Ubuntu server in mere seconds! That is INSANE! I am sure you are wondering "How does Docker achieve that much performance?". Here is the secret to Docker's superpowers. When you create a VM, you are recreating the whole OS including the kernel. That is very resource intensive, and therefore, takes a lot of time. Docker simply shares the kernel with the host. As you would expect, though, this comes with quite a few drawbacks. As stated befo

Demystifying Docker Networking: A Clear Guide

Docker containers are great! Nobody can deny that, right? When you have used docker, have you ever wondered how the networking works behind the scenes. Usually, you just create a container and it magically has access to all the networking, but what is really happening behind the scenes? Did you know you can actually configure this networking?! Not only that, there are SIX ways you can do it!!! Isn't that insane?! Let's see what those six ways are. Intro to Docker Networking Docker networking is insane, but at the most basic level, it works like this. Each container has is in a docker network. Each network has a network driver. This is basically a networking type. There are several drivers you can pick from. That is what we are going to cover here shortly. Bridge The first network driver is bridge. This is the most basic driver. This is what you have been using without realizing. Each time you create a docker container and don't specify the network, it goes into something ca