DEV Community

javinpaul
javinpaul

Posted on • Updated on

Why Every Developer should Learn Docker in 2022

Disclosure: This post includes affiliate links; I may receive compensation if you purchase products or services from the different links provided in this article.

Working with Containers: Docker & Docker Compose - Learn Interactively

Hello Devs, if you are wondering whether you should learn Docker in 2022 or not then you have come to the right place. I have been asking my readers to learn Docker since last year and also shared free Docker courses and best Docker books to encourage them to learn Docker.

Why have I been doing this? Because Docker is not just another tool, it's a game-changer, and I firmly believe that every Programmer, be it a Java developer, a C++ developer, or a Web Developer coding in JavaScript, all should learn Docker.

The first and foremost reason is that Docker simplifies both the development and Deployment of Software projects, for example, you can deploy a Java Microservice in the same way as a node application once you wrap them in a container.

Just like Maven made it easy to maintain project dependencies, Docker takes it to another level by building applications and shipping them into containers.

When you ship applications into the container, you don't need to deploy your application, OS, database, runtimes separately, instead you use them together as a container.

This makes deployment and scaling easier. If you want to scale further, you can deploy more containers very quickly instead of setting up a whole new environment.

Similarly, if you want to scale down, you can destroy containers quickly, and the best thing is you don't need to do that yourself, there are tools like Kubernetes which can manage and scale your Docker containers automatically.

Docker is also a big help for programmers, especially when you are starting on a new application. It is often troublesome to set up your application in IDE and run it from your Windows or Linux machine where you are doing development because of dependencies like on OS or a particular library, which is only available in specific versions of OS.

With Docker, you don't need that, you can just ship your application as a Docker image, and your team member can start and debug the application by running Docker images as a container.

This makes the Developer's life easy. Docker also helps with DevOps because it simplifies deployment and scaling, and that's why Every DevOps engineer should learn Docker in 2022.

These simplification of development, deployment, scalability, and DevOps are significant reasons to learn Docker in 2022, now that you know the crux of it let's go into a little bit more detail to understand why Docker is such an essential tool for programmers and DevOps professionals.

With every organization going towards the Cloud, the container model is going to be even more critical in the coming years, and Docker and Kubernetes will play a significant role in deploying and running software from Cloud.

That's why it's very, very important for both programmers and DevOps engineers to learn Docker and Kubernetes to do well on their current job and add an in-demand technical skill into their colorful resume.

And if you are serious about learning Docker in 2022 then I highly recommend you to check out Maximilian Schwarzmuller's Docker & Kubernetes: The Practical Guide course on Udemy This 23 course is now available for just $10 only on Udemy sale, which is like free considering its value.

Docker & Kubernetes: The Practical Guide best course


1. What is a Docker image?

Docker image is like a snapshot of your application. It is an executable file (like a big tarball) that contains everything your application needs to run, including operating systems, third-party libraries, configuration, and any other dependencies you need to execute your application.

You create a docker image by running the docker build command which takes your Dockerfile and creates a Docker image.

`` $ docker build -t myapp:v1.0 .

This command is building a Docker image from the docker file **myapp **which is present in the current directory. It has multiple layers stacked on top of each other and is represented as a single object. A docker image is created using a docker file, we will get to that in a bit.

You can also see all the images using the docker image command. You can further see Docker Mastery: with Kubernetes +Swarm from a Docker Captain course to learn more about essential Docker concepts and commands.

Why Developer should learn Docker


2. What is a Docker container?

Docker Container is a running instance of your docker image. When you run your docker image using the $ docker run command then these containers are created. Y*ou can run as many containers as you want using the same docker image.*

You can even run them on the same host as they are completely separated from each other. This is truly great and allows you to run any command from the web as the effect will be isolated to only that Docker container. Many online interactive courses platform like Educative, use Docker containers to allow users to run code from the browser.

So, you can see that it's straightforward to use Docker. All you need is to make a start, download Docker, create a Docker image by reusing an existing one from the Docker hub, and start running your application inside Docker container.

``$ docker run -p 8084:8084 -d myapp:v1.0

This command will start the docker container which will listen on port 8084. It will also be running in the background because we started the container in detached mode ( -d option).

Now when you run the docker ps command you can see this container running on the host/

why Java developer should learn Docker


3. What is difference between Virtual Machine and Docker?

Many developers often confuse between a VM and a Docker container. Let me tell you that both of them are different things.

They may look similar, but the most crucial difference between a Virtual Machine and Docker is that the underlying physical host and its resources are shared in containers but not in a Virtual Machine.

Since a picture is worth a thousand words, here is a diagram that clearly shows the difference between a Virtual machine and a Docker or any other container:

Docker vs Virtual Machine


4. How do you use Docker?

Now the question comes, how can programmers use Docker? Well, to use Docker you need to install it. Once you install Docker, you can execute docker commands to create a Docker file that contains the instructor to create a Docker image.

Once you have a Docker image you can run them using the $ docker run command and it will create Docker containers running your application.

I use Docker to run our apps which can only be run on Linux servers, earlier I used Virtual Box but with Docker I don't really need it.

You can further see Docker for Developers course on Educative to learn more about how developers can use Docker to make their life simple.

Docker for Developers - Learn Interactively course


5. Why do Developers and DevOps use Docker?

A couple of years back, when the business needed other applications, the DevOps or infra team would raise a request to purchase new servers and buy a server without knowing the performance requirements of the new application.

This often results in a wastage of money and resources, which could be used for other apps. They try to solve this problem by sharing a single host with multiple applications by running them on different participation, but that also put some management and operational overhead.

Then comes a wave of Virtualization and Virtual machines or VM, which allowed DevOps engineers to run multiple applications on the same physical resource but as a completely different server like you have separate runtime space and name, but there was a potential drawback.

Every Virtual machine required an entire OS to run. Every OS needs its own CPU, RAM, etc. to run, it needs patching and licensing, which in turn increases cost and resiliency.

Then comes the container model or Docker model, which was aimed to address the shortcomings of the Virtual Machine and mitigate the wastage of resources by sharing OS, CPU, and RAM and so far its most successful model.

It helps you scale your application on-demand as Docker makes the deployment easy and Kubernetes makes the deployment of Docker container at scale easier (see **A Practical Guide to Kubernetes **course) on Cloud Platforms like AWS, Azure, and Google Cloud Platform.

why every developer should learn Docker


6. How does Docker helps Developers?

The most significant benefit of Docker from a programmer's or developer's perspective is that it makes sure that the execution environment is the same for all developers and all servers I mean, including UAT, QA, Production.

The good thing is that any member of the team can set up the project quickly, with no need to mess with config, install libraries, set up dependencies, etc. In simple language, Docker is a platform that enables us to develop, deploy, and run applications with containers.

You can further check Getting Started with Docker By Nigel Poulton on Pluralsight to learn more about what benefits Docker offers to web developers. This diagram highlights some of the major benefits Docker offers to programmers and developers.

best Pluralsight course to learn Docker

By the way, you will need a Pluralsight membership to join this course which costs around $29 per month or $299 per year (14% discount now). I highly recommend this subscription to all programmers as it provides instant access to more than 7000+ online courses to learn any tech skill.

Alternatively, you can also use their 10-day-free-trial to watch this course for FREE.


That's all about why a developer should learn Docker in 2022. As I said, Docker really simplifies how you develop and deploy your code, and run your application. Shipping your application into a container makes deployment and scaling smooth and drives automation. It makes DevOps easy and makes your production environment robust.

With a more significant push to Cloud every year, the container model is going to be the default model for software development, and Docker and Kubernetes will play an essential role in the near future.

That's why every Developer and DevOps engineer should learn Docker to do well in their current job and also add an in-demand skill on their resume to get a better job.

Other DevOps Articles and Courses you may like

Thanks for reading this article so far. If you also think that every developer or Programmer should learn Docker in 2022, then please share it with your friends and colleagues. Together we'll help each other to become better programmers and developers.

P. S. - If you are want to learn Docker and Kubernetes in-depth and looking for the best online courses then you can also check out Stephen Grider's Docker and Kubernetes: The Complete Guide course on Udemy. It's a great course to learn both of these tools in 2022.

Discussion (6)

Collapse
bobbyiliev profile image
Bobby Iliev

Great article! For anyone interested, here is also a free eBook that would quickly get you up to speed:

GitHub logo bobbyiliev / introduction-to-docker-ebook

Free Introduction to Docker eBook

πŸ’‘ Introduction to Docker

This is an open-source introduction to Docker guide that will help you learn the basics of Docker and how to start using containers for your SysOps, DevOps, and Dev projects. No matter if you are a DevOps/SysOps engineer, developer, or just a Linux enthusiast, you will most likely have to use Docker at some point in your career.

The guide is suitable for anyone working as a developer, system administrator, or a DevOps engineer and wants to learn the basics of Docker.

πŸš€ Download

To download a copy of the ebook use one of the following links:

πŸ“˜ Chapters

🌟 Sponsors

Thanks to these fantastic companies that made this book possible!

…
Collapse
ecurbnosneb profile image
EcurbNosneb

I'm hooked on VMs as I like the ability to snapshot and roll back changes easily. I can also live migrate the VM with little interruption in service. I've not found containers to be as flexible but I do like how small a footprint they have.

Collapse
javinpaul profile image
javinpaul Author

Nice, thx for sharing

Collapse
jefflindholm profile image
Jeff Lindholm

If you use powershell the following in your profile file, will create an alias for you.
dev-here (language) "ruby, node, dotnet, etc" will get the latest container start it and put yuou in a shell with your current directory mounted to 'code' with port 8000 open by default. Working on the python piece still

function dev-here($lang, $port = 8000) {
if ($lang -eq '') {
echo 'usage is dev-here '
return
}
$args = 'bash'
if ($lang -eq 'python') {
$args = "bash"
# $args = "bash -c 'cd code && pip install -r requirements.txt && bash'"
}
$msg = $lang + ' opening port ' + $port + ' running ' + $args
echo $msg
echo "docker run --rm -it -e USER=dev -p ${port}:${port} -v ${PWD}:/code --network="host" $lang $args"
docker run --rm -it -e USER=dev -p ${port}:${port} -v ${PWD}:/code --network="host" $lang $args
}

Collapse
gjorgivarelov profile image
gjorgivarelov

I am sure somebody will find some value in this article, probably one that never had to deal with containers. Can't overlook and forgive the "invitation" to join PluralSight however, nice try at subscription sales.

Collapse
shriharshmishra profile image
Shriharsh

Learning docker in 2018 was a great investment for me. All developers should learn docker for sure.

Good article!