Let’s talk Docker (Part–1)
Alex: What is Docker?
Adriana: According to the Oxford dictionary Docker means “A person employed in a port to load and unload ships”.
Alex: Yes, you are right, we are going to learn about him.
Adriana: Wait a minute, we need to change the question. It should ask “Who is Docker?”
- The good guy who is loading the container is called Docker.
- The thing he is uploading is call container image
- The place where he is uploading is call cargo we name it, ‘DockerHub’
Alex: Now let us go back to a formal definition
Docker is an open-source engine which automates the deployment of applications as highly portable, self-sufficient containers which are independent of hardware, language, framework, packaging system and hosting provider
Adriana: Wow!!!! What does it mean? 😀
Alex: Simply Docker is a program that allows you to create images of your software with everything it needs, uploads it in DockerHub and allows others to pull from DockerHub and use it.
Adriana: Now it makes sense.
- In real life, a container is used to transport goods. Goods can be anything, vegetable, fruits, clothing, car and everything.
- Different things need different approaches to handle. One cannot handle fruits and clothing in a similar manner because fruits get rotten within days but clothing will take some time. One has to use preservatives or cold storage for fruit preservation.
- Similarly, Docker creates an image of an application with whatever it need and upload it to DockerHub and let others use it.
William: Alex and Adriana, shut up!!!
William: Now let us discuss some components of Docker.
Docker Image: A Docker image is a read-only template. For example, an image could contain an Ubuntu operating system with Apache and your web application installed. Images are used to create Docker containers.
Docker Containers: Docker containers wrap up a piece of software in a complete file system that contains everything it needs to run: code, runtime, system tools, and system libraries – anything you can install on a server. This guarantees that it will always run the same, regardless of the environment it is running in.
Docker file: Docker file can be called the recipe of a Docker image. This Docker file builds Docker image. This Docker files usually 5-30 lines with some commands and specifications.
Docker Hub: Docker Hub is a centralized resource for container image discovery, distribution and change management, user and team collaboration, and workflow automation throughout the development pipeline.
Image Repositories: Find, manage, and push and pull images from a community, official, and private image libraries. A powerful feature to share images with co-workers, customer or Docker community.
Automated Builds: Automatically create new images when you make changes to a source GitHub or Bitbucket repository.
Webhooks: After a successful push to the repository, Webhooks trigger action/chain of actions in another application. This is optional with Automated Builds.
Organizations: Create workgroups to manage user access to image repositories.
GitHub and Bitbucket Integration: Add the Hub and your Docker Images to your current workflows.
To know more on Docker, visit official documentation:
Adriana: I am confused about Docker Image and Docker Container. They sound similar.
Alex: It is similar to the concept of Class and Object of OOP. An image is the read-only template and container is the running instance of the image.
If we want to make a relation between these, we can refer to the following picture:
Alex: Is it making sense now?
Adriana: yeah, completely.
Adriana: In the picture, my machine can be windows, Linux or any other OS. Does Docker has multiple OS support?
Alex: Oui (Yes in French; Solomon Hykes started Docker in France)
William: Alex and Adriana, shut up!!!
Docker in Linux
On September 19, 2013, Red Hat and Docker announced a significant collaboration around Fedora, Red Hat Enterprise Linux. Since then Docker is an important feature of Linux.
In Linux, Docker client runs different container in different daemons.
Docker in windows 7 to pre-server 2016/Nano
For windows 7 to preserver 2016/Nano, Docker client runs a Linux VM,withinn the VM different container runs on different Daemon.
Docker in Windows 2016/Nano
Docker in windows 2016/Nano runs on base OS.
Adriana: Cool, Docker is awesome. But how can I be helpful? I am just another admin guy, not a developer.
Alex: Absolutely, Docker is a tool that is designed to benefit both developers and system administrators, making it a part of many DevOps (developers + operations) toolchains. For developers, it means that they can focus on writing code without worrying about the system that it will ultimately be running on. Once the app configuration is complete and tested, developers can create a Docker image of the application and related dependencies. System administrators can then deploy the Docker images without having to wrestle with makefiles and potential compiler errors.
Alex: FYI, Docker is written in Go (programming language)