DEV Community

Cover image for Introducing Docker Concepts, Containers, and more 
Roseline Bassey
Roseline Bassey

Posted on • Edited on

Introducing Docker Concepts, Containers, and more 

Containerization has rapidly gained popularity as a game-changing technology, enabling developers to package applications and their dependencies into self-contained units known as containers. Docker, with its user-friendly interface and powerful features, has emerged as the go-to solution for harnessing the full potential of containerization.

Throughout this article, we will demystify the core concepts of containerization, shed light on the remarkable benefits it offers, and zoom in on Docker's architecture and key components. We will delve into the difference between Docker and virtual machines, and containers themselves, where applications run in isolation, providing enhanced scalability, flexibility, and efficiency.
Before then, let's learn about Docker.

What is Docker?

Docker is an open-source containerization platform used to build, test, manage, and deploy applications in a cloud-based environment.

Docker provides a way to package an application into a "container," which can be run from any machine that has the Docker software installed. It makes it easy for you to run an application across different machines or environments.

How to get started with Docker

As organizations shift toward cloud-native and hybrid development, Docker is rapidly becoming the preferred tool for building and sharing containerized apps.

Origin of Docker

Docker was first released in 2013 and has since become one of the most popular tools for developers. The idea for Docker came about when Solomon Hykes, the creator of Docker, was working on a project at dotCloud, a cloud hosting provider.

The project required him to use many different virtual machines, each with different versions of the same software. This was difficult to manage and ended up being very time-consuming.

To make his life easier, Solomon created a tool that would enable him to package an application and its dependencies into a single container.

This way, he could easily move the application between different machines without having to worry about compatibility issues.

Docker makes it easy for developers to create, deploy, and run applications in a consistent environment, without the need to worry about differences between machines.

Docker has since gained popularity and saw more support from commercial companies such as Amazon and Microsoft, further bolstering its credibility in the container management market.

How Did it Become so Popular?

Docker became popular because it offered a way to package an application with all its dependencies into a “container”.

The containers are portable and can be run on any machine that has the Docker runtime installed. It also provided a way to share these containers using Docker Hub, which is like GitHub but for Docker images.

Problem Before Docker

In the past, developing and deploying software applications has been a time-consuming and error-prone process.
This is because each application has its dependencies and configurations, which can often conflict with other applications.

Traditionally, applications are built on a type of architecture called monolithic. In monolithic architecture, all components of an application are packaged together in one large program.

Each line of code, libraries, and dependencies is connected to one another–meaning that each layer of the application is built on top of each other which often creates a series of problems.

In traditional methods, code is developed in a specific computing environment which, when transferred to a new location, often results in bugs and errors.

One of the most likely problems developers complain about is the "it works on my machine" problem. With Docker, developers can collaborate on projects without fear of breaking each other's code.

Imagine you are part of a developer's team and you are working on a Javascript application that requires PostgreSQL and Redis for messaging.

You'll need to install these services directly on your operating system. For any developer within your team to deploy the app, they must install binaries of these services, configure them, and run them locally.

Installation may look very different depending on which operating system is used and may involve many steps that need to be performed, and perhaps something could turn out wrong.

This process can be frustrating, and costly, and you may have some difficulty scaling and deploying applications.

Deploying and packaging apps in a reliable and repeatable way has always been a pain point.

According to Rob Vettor and Steve “ardalis” in , Architecting Cloud-Native .NET Apps for Azure, some of the problems you could face using this architecture include:

  • The app has become so overwhelmingly complicated that no single person understands it.

  • You fear making changes - each change has unintended and costly side effects.

  • New features/fixes become tricky, time-consuming, and expensive to implement.

  • Each release becomes as small as possible and requires the full deployment of the entire application.

  • One unstable component can crash the entire system.

  • New technologies and frameworks aren’t an option.

  • Its difficult to implement agile delivery methodologies.

  • Architectural erosion sets in as the code base deteriorates with never-ending “quick fixes.”

  • Finally, the consultants come in and tell you to rewrite it.

Due to this, many organizations have shifted to adopting a cloud-native approach to building containerized applications.

Containerization

Containerization eliminates these problems by bundling the application code together with the related configuration files and dependencies, making it easy to deploy and run in any environment.

Containerization is a type of virtualization that allows you to run multiple applications on a single server. This can be extremely beneficial for businesses, as it can help to save on server costs and increase efficiency.

Containerization has many benefits, but one of the most important is that it eliminates the "it works on my machine" problem.

This is because the container includes everything needed to run the application, so it will work the same in any environment. This is a huge benefit for software developers, as it makes it much easier to develop and test applications.

If you're looking for a way to improve the development and deployment of your software, then containerization is a great option to consider.

Container

Containers help simplify the process of deploying applications. Containers allow you to isolate each component or layer of an application from each other. It allows you to run different applications on the same host without them interfering with each other.

what is containerization
Image source: Docker

In the diagram above, each application(container) is isolated from other containers managed by Docker in your host operating system.

Hence, the breakdown of one container does not affect the performance of another.

Benefits of Containers.

Some of the key benefits of containerization include:

  • Containers are lighter and require fewer resources thereby, making them more efficient to run.

  • Containers can be moved easily between environments, making them ideal for development and testing.

  • Isolation between containers prevents one application from affecting another, improving stability and security.

  • Increased security, since container isolation prevents malicious code from infecting the underlying system.

  • Improved performance, since containers do not need to be booted every time they are run.

  • Easy to Use: Containerization is easy to set up and use, which can save you time and money.

  • Scalable: You can easily scale your containerized applications to meet the demands of your business.

  • Portable: You can move containerized applications between servers, which makes it easy to maintain and update them.

Overall, containerization provides a more efficient and robust way to deploy applications.

Monolithic

Monolithic software architecture is one in which all components are tightly coupled and interdependent. This type of architecture has been traditionally used for large-scale applications.

The main disadvantage of a monolithic architecture is that it can be more difficult to maintain and modify.

Because all components are tightly coupled, a change to one component can potentially break other components. In addition, monolithic architectures can be more difficult to scale than other architectures.

Microservices

Microservices refers to the practice by which applications are broken down into smaller pieces called “microservices” so they can be built individually and then wired together when needed.
This allows for greater flexibility and scalability.

The difference between Docker and virtual machines

Docker and virtual machines are both popular ways to organize and isolate applications.

The difference between Docker and virtual machines
Image source: Medium

Docker is a containerization platform that allows you to create and run isolated applications. With Docker, you can bundle your application into containers.

Containers are lighter than virtual machines and can be spun up more quickly. They're also more portable since they can be deployed on any machine that supports Docker.

Virtual machines are full-fledged operating systems that are run on top of a hypervisor. Virtual machines are also less portable than containers since they require specific hardware configurations.

They're also heavier and take longer to spin up. They are isolated from each other, so an attacker who compromises one virtual machine cannot access other virtual machines on the same host.

Summary:

Our discussion covered the basics that can help you get started with Docker, but you also learned about Docker as a whole, why Docker was created, and the problems it addresses.

You also learned about containerization and how it makes it easier to deploy apps from desktops to the cloud. You learned about the benefits of using containers in app development.

The difference between a virtual machine and Docker was also discussed, as well as monolithic and microservices.

Learn more about Docker commands you'll frequently used as a beginner.

The following resources will help you learn more about Docker:

Resources:

Introduction to Container By Red Hat

TechWorld with Nana - Docker Tutorial for Beginners

Docker Tutorial for Beginners - What is Docker? Introduction to Containers

Programming with Mosh - Docker Tutorial for Beginners

Top comments (8)

Collapse
 
danvin001 profile image
Dan Vin

Excellent article, thank you for clarifying containers universe. That brings me a question; In the last diagram, we can see that it needs Host Operating System. Does the container can be move, let's say, from a Linux host to a Windows host? Do you have to redo your container with the Windows dependencies?
Thank's again :-)

Collapse
 
roselinebassey profile image
Roseline Bassey

Hey, Dan.

In response to your question, Docker container shares the host operating system, CPU and memory.

When moving a Docker container to a new environment, you do not need to reinstall dependencies or files.

Docker understands the pain of moving an application between environments.

Therefore, it provides a virtualized environment for the application inside the container.

I hope this response addresses all your questions.

Thank you for finding this article useful.

Collapse
 
rukundob451 profile image
Benjamin Rukundo

Awesome read, everyone should surely give it a go.

Collapse
 
roselinebassey profile image
Roseline Bassey

Thanks, Benjamin.

Collapse
 
stubowles profile image
Stu Bowles

Well done!

Collapse
 
roselinebassey profile image
Roseline Bassey

Thanks, Stu.

Collapse
 
pdfreviewer profile image
pdfreviewer

I use docker + minikube as my dev environment, and they greatly improved my productivity.

Collapse
 
sanjayalagappan profile image
Sanjay

Thanks Rose for giving us a great article on the fundamentals of Docker and Containers ✨.