
Docker for dummies
"But this worked perfectly fine on my computer".
Updated

On this page
Updated November 2026. This was first published on 25 August 2020. The idea is the same. Any number below is what the original piece said then. It is not a new count.
Key takeaways
- “But this worked perfectly fine on my computer”.
- This is something you frequently hear when you develop a project/software on your computer and it does not work on other computers due to certain configuration and dependency issues.
- The project that ran perfectly on the developer machine might not run when it is moved to the production state or to the server.
“But this worked perfectly fine on my computer”. This is something you frequently hear when you develop a project/software on your computer and it does not work on other computers due to certain configuration and dependency issues. The project that ran perfectly on the developer machine might not run when it is moved to the production state or to the server. For example, if a project requires Python 3.1 but the other computer has Python 2.7 installed the project will not run on the computer even the code being compiled is exactly the same. In this case, the other computer has to install the same version of the programs needed to run the application. This results in waste of time and effort. Docker just rather creates an image that the developer can share with the client or anyone else.
Docker is meant to deal with the problem mentioned here. It works with any programming language or any project that you build. Docker helps transport the project to other computers with exactly the same configurations and dependencies (A perfect copy) so that it runs smoothly on any system irrespective of how it is configured. All this sorcery is done with something called **containers.
What are containers? #
A container is basically a single package of the project and all the other configurations required to run the project. These containers are portable and when used in other computers, it runs smoothly without any compatibility issues as it worked in the developer machine.
Every new container consists of a starter file called Dockerfile. It is a text file that consists of the instructions to build a Docker image. The Dockerfile usually consists of the code, dependencies, configuration, network information and more. It might also consist of a small fragment of your operating system to tweak the application to run effortlessly on the client’s system. It also has to specify what the container should do when we run it.
Containers give developers a head-start by allowing them to use a starting program or a program that is a part of a larger application. Docker allows something called social containers. These are socially sharable on a platform just like how you share pictures on social media. Anyone who wants to deploy and access a container can do so using DockerHub. For example, installing core MySQL onto a system is not the most simplest task. Rather than spending time on following the entire procedure, one can simply use a container shared on DockerHub to get started with learning MySQL.
The Docker build utility is used to create an image as mentioned above. It uses the Dockerfile that contains the instructions to tell build how to create the image. The Docker image is a file that is used to mention the specifications that will be required to run a container.
Docker images and containers seem like they are doing same thing but they actually don’t. They are completely different in function.
A Docker image is a package that consists of the code, dependencies, process, configuration, network information and more. These packages are executable.Whereas a Docker container is a runtime instance of an image.
Is Docker a reiteration of Virtual Machines? #
Even though it sounds very similar to Virtual Machines, Docker does not create an entire virtual operating system. It rather focuses on the individual components that the application needs to work. Virtual machines use more resources and also take a significantly longer time to boot up.
No need to build an entire operating system.
Containers isolate the application’s execution environment and work as individual nodes while sharing the same underlying OS kernel. Since it only uses the individual components, it results in faster performance and a significant reduction in file size.
Why Docker? #
Docker promotes the idea of micro-services where there exists several different services that each execute a certain function independently. All these services are part of a single large application. These services can be created as separate containers. This helps tremendously with programming in a well defined structure. This approach is ideal for larger applications where scalability has to be seriously considered.
For example, consider a messaging service where you would want a server to handle the message board, another server to handle the cache and so on. This sure does sound like an expensive affair and a developer would rather put all this on a single machine. The problem with doing so is that the dependencies get mixed up where a certain service uses php 5 and another service requires php 7. At this point, it gets too confusing and messed up. Docker breaks it up into containers which can then be fed with rules for what to do when it crashes, resources to allocate or scalability rules.
Docker being open-source, provides flexibility to users who want to contribute to Docker to make it meet their own needs. This is quite handy since certain developers will need features that are not currently a part of Docker. This also opens the door to introducing a large set of features considering the fact that a massive community is contributing to Docker to make it better for themselves and for other users.
How do the containers work together as a single application? #
Docker provides a away to build an application by connecting several containers. This is achieved by the use of Docker Compose which makes it easier to develop and work with multi-container applications. It takes in a descriptor file that is specially formatted to combine the several containers and make them work together as a single application.
Kubernetes is a system that provides a more advanced version of managing multi-container applications. It is responsible for orchestration of the the containers. It consists of tools to deploy applications, managing changes to the existing containerized applications and also helps manage the underlying hardware used by the application. Kubernetes is the current market leader for this purpose.
Container orchestration automates the deployment, management, scaling, and networking of containers.
To learn more about Docker, check the official Docker website.
Questions and answers #
What are containers? #
A container is basically a single package of the project and all the other configurations required to run the project. These containers are portable and when used in other computers, it runs smoothly without any compatibility issues as it worked in the developer machine.
Is Docker a reiteration of Virtual Machines? #
Even though it sounds very similar to Virtual Machines, Docker does not create an entire virtual operating system. It rather focuses on the individual components that the application needs to work.
Why Docker? #
Docker promotes the idea of micro-services where there exists several different services that each execute a certain function independently. All these services are part of a single large application.
How do the containers work together as a single application? #
Docker provides a away to build an application by connecting several containers. This is achieved by the use of Docker Compose which makes it easier to develop and work with multi-container applications.