Notes: Re-jigging my Docker knowledge 🍱
Tags: devops, devjournal, dotnet, architecture
Published: 2021-07-30 18:57:53

This is just a stream of things that I noted down to help me re-jig my knowledge of docker: because, I want to 🧐

*“In a way, Docker is a bit like a virtual machine. But unlike a virtual machine, rather than creating a whole virtual operating system, Docker allows applications to use the same Linux kernel as the system that they're running on and only requires applications be shipped with things not already running on the host computer.”* - [OpenSource.com](https://opensource.com/resources/what-docker)

I knew what docker was, but at the same time the understanding didn’t fully seep in to my foremost consciousness to be able to say that I actively “know” what it is and what it is useful for. As it can be seen from the extracts above, we can clearly see how portable docker is kind of like a make-shift “VM” without the need for all the supposed junk that comes along with it. Many layers are cut off from the vm to give us a package or “container” where we can run our built version of our projects (images) with ease, without worrying about any OS specifics. 

![A simple drawing that shows the difference between docker and a standard VM](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ml0ya427j7qytv5ytrkd.png)

## What are containers? 

*“A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another.”*  - [Docker.com](https://www.docker.com/resources/what-container) 

![A picture explaining containerized applications](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ys0ddnjdmmh6u5h62tax.png)

In a video explanation by Solomon Hykes ([link here](https://www.youtube.com/watch?v=Q5POuMHxW-0)), he introduced the essence of containers through his example of how things were shipped in the early days (e.g a 100 years ago). The original way for shipping specific goods may have been too specialized that it could be costly to hire a specialist to take care of delivery of this good. 

![How can you specialize for all the shipping methods?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2zrxwxlzvjoikpovvmcs.png)

All of these products may need a special way to be shipped if it takes any one of those specific shipping options. This is where the solution comes in, the introduction of the universal container. 

![A standard container became the solution](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vmpn139tzh6hki147gia.png)

This revolutionized the shipping industry, in that now the concerns are somewhat separated. Once the item is in the container, the responsibility from the sender’s side is complete. The shipping is done all the same for all products, they all go in this type of container. This makes it easier for the industry to concentrate on other aspects of shipping like improving the size of the boat or efficiency of it etc.  

The same thing can be said when it comes to the devops side of what we do. 
![Same thing, different example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a5zz1pks6q3rouk0yo7k.png)

##What is a dockerfile? 

*“..the Docker file says what to build that will be the Docker image. These files have everything to eventually build a container.”* - [blog.iron.io](https://blog.iron.io/what-is-a-docker-image/)

*“Every Docker container starts with a simple text file containing instructions for how to build the Docker container image. DockerFile automates the process of Docker image creation. It’s essentially a list of commands that Docker Engine will run in order to assemble the image.”* - [ibm.com](https://www.ibm.com/cloud/learn/docker)

![Dockerfile explained](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/63zed1ku2g58jjprupah.png)

##What is a docker image? 

A docker image acts like a template for creating a container, with a set of instructions and specifics in order to be run as intended. A docker image can usually be created by a dockerfile as well. 

*“A Docker image is the set of processes outlined in the Docker file. It is helpful to think of these as templates created by the Docker files. These are arranged in layers automatically. Each layer is dependent on the layer below it. Each layer then becomes more abstracted than the layer below.”* - [ibm.com](https://www.ibm.com/cloud/learn/docker) 

## Why you should use it and what it doesn't solve
- Taken from [infoWorld.com](https://www.infoworld.com/article/3310941/why-you-should-use-docker-and-containers.html)

###Why you should use it

* Docker enables more efficient use of system resources 
 - Instances of containerized apps use far less memory than VM’s do 
 - Faster start and stop procedures than VMs 
 - Cheaper to run because it’s less resource intensive 

* Docker enables faster software delivery cycles 
 - It makes it easy to put new versions of software, with new business features, into production quickly—and to quickly roll back to a previous version if you need to. 
 - They also make it easier to implement strategies like blue/green deployments

* Docker enables application portability 
 - Any host with the Docker runtime installed—be it a developer’s laptop or a public cloud instance—can run a Docker container. 
 - Docker shines for microservices architecture 


###Things docker does not solve 

* Docker won’t fix your security issues 
 - Containers can add a layer of security to an app, but only as part of a general program of securing an app in context 

* Docker doesn’t turn applications magically into microservices 
 - You’ve got to do the leg work, old apps in containers don’t make them any better 

* Docker is not a substitute for a VM, don’t make that assumption 
 - Some apps may not be able to, or should not, move to a container. This is mostly due to the app itself and the purpose it serves. 


## Next chapter

The next chapter will entail my findings going through docker in action. I will detail starting up docker, running a container and what I feel about it.

Thanks for taking the time to read :)