Introduction to Docker
Explore the fundamentals of Docker and how it solves deployment issues by containerizing applications. Learn about Docker images and containers and their role in consistent SQL and Node.js environments.
We'll cover the following...
Overview of Docker
The apps we develop as engineers evolve from simple to complex. As the complexity increases, the dependencies, logic, and plugins used in developing these apps increase in number and complexity.
After the apps are developed on a host machine, the results are often dramatic when those apps are shipped to a different host machine. The app works on one machine and fails on the other. When tried again on a different host machine, they may either work or fail again.
We usually encounter these kinds of problems in software development across distributed teams. One solution to this problem is Docker.
How Docker works
With Docker, we can containerize our applications and ship the container. Imagine shipping crates of eggs to a faraway relative in a different country without using a standard shipping service. Those eggs could face great peril! Docker helps us ship code efficiently without the fear it will break in the future or fail on other host machines.
After developing our applications, we package them into something called an image. An image (or a Docker image) is an immutable file that contains the source codes, dependencies, tools, plugins, and everything the application needs to run.
We can then deploy this image in a registry such as Docker Hub, where other developers can download and run this image.
Note: A Docker container is simply a virtualized runtime environment. It can be seen as a running Docker image.
Benefits of immutability
Docker images are immutable. This means that once created, they can’t be changed but only destroyed. This way, once we package our apps into images, every other host machine can only run this image on its local system without the image breaking.