Getting Started with Docker
Introduction to Creating and Running Containerized Programs
What Is Docker?
If you’re dipping your toes in the world of DevOps or Cybersecurity, it won’t be long before you start discovering some chatter about Docker, Kubernetes and, containerization. These topics can seem pretty complex and to be honest, they kind of are. However, you don’t have to fully understand all of the inner workings of Docker to start enjoying the benefits it offers.
At a high level, Docker is like an ecosystem of services that allows programmers to create and run something called containers. A container is an isolated environment that wraps up everything needed to start and run a program on your local machine. This helps developers to avoid delays in programming when installing the necessary software and its dependencies. Instead of installing a piece of software, getting error messages due to lack of dependencies needed, googling the solution, installing the missing package, getting more error messages, and starting the cycle over again, you can run a single command to install everything that is needed at once!
Breakdown of Docker Services
One thing that can be confusing is that when you hear people refer to Docker, they could be talking about a single part of the platform such as the client, server, hub, etc, or the ecosystem as a whole. We’ll discuss a few of these parts individually and what they are responsible for.
The Docker Client is essentially a CLI tool that is used to issue commands and communicate to the Docker Server which listens for instructions to run containers and other functions. As mentioned earlier, you can install a piece of software and its dependencies at the same time. This is done by typing the following command within the CLI:
docker run -it software-name-here
You can also have the Client ask the Server to create something called a Docker Image that acts as a private file system for your container. It provides all the files and code that a specific container needs to run.
Images can be saved and shared via the cloud-based Docker Hub. This allows other users to easily download and run an Image on another machine. To use the Hub, you’ll need to create an account on the Docker website with your own unique id. For applications that utilize this cloud-based service, when the above run command is executed from the CLI, the Client communicates to the Hub and downloads an instance of the Image which can be used to create a container.
Before moving on, I have to mention the Docker Dashboard. It’s an incredibly useful tool for viewing and managing containers that are running on your local machine. It gives quick access to logs, individual container shells, the ability to start/stop or remove containers, and more actions.
Kubernetes
A brief introduction to Docker wouldn’t be complete without discussing Kubernetes. This tool can run many containers at the same time by following the configuration provided by the developer that describes how they should start and interact with each other.
For example, a configuration file might contain instructions to run several copies of one service that is wrapped in a series of containers. It could also include specifications for the accessibility of those copies. A Kubernetes Cluster holds many virtual machines called nodes. These nodes are managed by a program referred to as ‘master’.
Endless Possibilities
Hopefully, this topic has your wheels turning. There are so many use cases where containerization through Docker can come in handy. Containerization enables you to run an application with its own private resources that are securely separated from the rest of your machine. How cool it that!
This is useful for working with microservices, rapidly getting a new program up and running on your local environment, testing the effectiveness of security within an application, and so much more. There’s a ton of information to absorb within the Docker documentation. To get started, follow the guides for downloading Docker on your specific system. Then be sure to sign up for a Hub account so you can save and share your Images with teammates. All containers on your machine can be viewed and maintained easily through the Dashboard. Check out the resources below to explore the endless possibilities these tools offer today!