Table of Contents
- What is Docker?
- Docker Container
- The layout of the Containerized application
- Conventional Layout of the project code
- Docker Infrastructure
- Inner-loop development workflow for Docker apps
- Video Tutorial
1 What is Docker?
- Docker is an open-source software platform to create, deploy, and manage virtualized application containers on a common operating system (OS).
- Docker is a tool that packages, provisions, and runs containers independent of the OS.
- Each container shares the services of one underlying operating system.
2 Docker Container
- Docker Container is a standardized unit that can be created on the fly to deploy a particular application or environment.
- It could be an Ubuntu container, CentOS container, etc. to fulfill the requirement from an operating system point of view.
- It could be an application-oriented container also like a CakePHP container or a Tomcat-Ubuntu container etc.
3 The layout of the Containerized application
- Here, we have infrastructure which is the whole layout on which we have on host OS.
- This OS should be Ubuntu, Linux, or any other Operating System and upon those OS we place the Docker Container and in a single Docker container, there are several types of the application launched. All applications are using the resource of this host operating system.
4 Conventional Layout of the project code
- In the above diagram, we have project code and provisioning script so through the provisioning script we can pass on the code through various stages like you want to pass on the code to a virtual machine we can do that or in case we want to store the code, we can store the code on GitHub and also in case we want to deploy the code to a production server we can do that.
- Also the same we can apply to the Staging server too.
- The main issue lies is that if we have a single application and different virtual machines or different production servers then we have to again go on that system and again launch the same code, again deploy the same code on the server and that could be a little bit tidy.
5 Docker Infrastructure
- So what Docker does is that we can use the Docker images to deploy your code so as the above docker infrastructure we have the project code and we have the docker file so the Docker file creates a Docker image and the Docker image stored in the container.
- In that Docker image, we can store various types of application which will be consuming the configurations of the virtual machines.
- We can create as many containers as we want and also, we launch as many applications in those containers.
- So once let us there are two application in a container and if we have four application then we simply add a virtual machine and we can extend our containers like that.
- After that, we simply store our container in Docker Hub. Docker Hub is the facility provided by Docker to store the Docker containers remotely so we can access them from anywhere.
- The dependency on the project code totally upon Docker Hub. From Docker Hub, we simply deploy our application on both the staging and production servers.
- If we want to have multiple applications running on multiple containers then we can create a cluster or a cloud.
- Cluster is the collection of different type of containers on which different type of application is present.
- As shown in the above infrastructure let, we have created a cluster, and the cluster has two containers. One has application A and B and container two has application C and D and this both containers are using the resources independently of the Operating System so we can launch as many containers as we want and in case, we want accessibility from outside then we can install the server on the cluster. So, we can access these containers outside the world.
6 Inner-loop development workflow for Docker apps
The steps as given below:
- Step 1- We code our app
- Step 2- We write the Docker files
- Step-3- In the third step we define the Docker images so Docker images simply the applications stored on the Docker containers and this image can be stored on a remote Docker registry.
- Step-4- Fourth step is to define services by writing so we write the docker-compose.yml file and through this file, the Docker containers are running.
- Step-5- In this step, the Docker container run or compose the files and move to step 6 for testing environment.
- Step-6- We can test our application using Docker container in this environment
- Step-7- Once the passed through environment the Dockercode container is pushed to the developing environment and further it can be pushed to staging and the production environment.
This is the whole layout that how the Docker container works.