Docker Crash Course For Beginners : Step By Step Guide

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi guys good morning everyone is my voice Audible for the people who are watching in the zoom and who are watching in YouTube [Music] live yes good thanks for confirmation guys uh all of you welcome to Ashok it today we are here to understand what is Docker why Docker and how to work with Docker what is the importance for the docker in the real time projects implementation good before going to start uh this is one day workshop it's like a crash course on the docker this Workshop will be available for two to two and a half hours of time and we will understand theoretical part as well as practicals also on the docker good once this Workshop got completed I will share the required notes materials and the backup video also will be available for you people I'm sharing a WhatsApp group Link in the chat box so if you join in that group you will get all the documents after the session got completed got it have shared WhatsApp group Link in the chat box all of you can join in that good fine guys let's get started so first of all what is Docker first of all what is Docker some people will say Docker is a devops tool every devops Engineers should know Docker so Docker is not only for the devops engineers even Developers also should know what is Docker so we can say Docker is used for containerization it is a containerization tool Docker is used to perform containerization for our applications here comes the biggest question what is containerization so before going to understand what is a containerization first we need to understand our application architecture so in simple terminology to give give the definition for the docker so we can say what is Docker and Docker is a containerization software but it's very high level terminology what is that containerization so before getting into containerization part let's understand application architecture if you take any project if you take any project you can see you can see front end will be available for the project back end will be available for the project and database also will be available for the project so database is used to store our application data there are so many databases available in the market like warle MySQL SQL Server mongodb Etc there are so many databases available depends on the requirement we will use one database for our application along with that for every project backend will be available backend contains business logic so the business logic will be implemented in the back end to implement back end of the application there are several Technologies are available Java net python PHP nodejs like that there are so many Technologies are available by using those Technologies we can develop back end of the application back end contains only business logic then coming to the front end user interface whatever you see on the browser that is called as user interface that is also called as front end in order to develop front end the application we are going to use several front end Technologies like angular react angular react or vue.js like that there are several frontend Technologies are available by using those front-end Technologies we are going to develop the user interface of the project guys for all of you is my voice clear is my screen and why is clear for everyone yeah good so a project contains three layers guys front end will be available back end will be available and database will be available so this is application architecture so when we are talking about a project a application contains front end that front end nothing but user interface and back end will be available and database will be available so front end is used to develop user interface to develop the front end there are several Technologies like angular re .js like this there are several Technologies are available to develop back end of the application there are several Technologies like Java net python PHP Etc like that there are several Technologies are available to develop back end of the application coming to database for every project database is mandatory so like vacle or my SQL or SQL Server like that there are several databases are available now let us take one example suppose I want to build one project I want to develop one project and I want to deliver that project to the customer now we need to take application text tag we need to take the application text tag that means what are the Technologies we are going to use to develop our application that is called application text tack so here for the front end I'm using angular assume that for the front end I'm using angular 13 version and for back end I'm using Java 17 version and for database I'm using my SQL 8.5 version my SQL 8.5 version I'm using so this is called application text tack so I want to develop your project for the project development we are going to use angular 13 version for the front end development and for Java we are for backend development we are using Java 17 version and for a database we are using myql 8.5 version now fine so in order to develop this application in order to develop this application we are taking these Technologies then after once the project development got completed development team will be available the development team is going to write the code front end code backend code database queries they will they will develop your project once they develop the project we need to deploy this application so developers should run this application and devops Engineers should deploy this application in the higher environment okay so now we need to understand environment setup to run our application so what we need to do in order to run our application in order to run our application we need a platform development team completed the coding part and they have stored the code to GitHub now it is the responsibility of the devops engineers to deploy this application in the higher environments so in order to deploy this application devops Engineers should prepare environment so what they have to do take one machine take one machine so we can say it is a physical machine or virtual machine anything is fine a physical or virtual so we need to take one machine after that install install angular 13 version because to run the front end code angular software is required so if you want to run your application in a computer then you need to take one computer with o that can be a physical machine or that can be a virtual machine install angular 13 version in that machine then after install Java 17 version install Java 17 version and install install Tomcat server because to run the Java application Tomcat server is required install Tomcat server 9.0 version then after install my SQL database server install MySQL DB server 8.5 version so this is called as environment setup we have we are working on a project our project is having front end backend database for front end there are so many Technologies are available we are using angular for the front end development back end we can develop by using multiple Technologies we are using Java 17 version to develop the back end of the project there are so many databases available for our project we are using my SQL database which is 8.5 version got my point good now here in order to run this application we need to prepare the environment environment setup is required to run our application so how environment setup will be done devops people are going to do this environment setup in order to deploy and run our application they need to take one computer that can be a physical computer or virtual computer and they need to install angular software because to run the front end code angular is required and to run the backend code Java software is required they need to install Java version and they need to install Tomcat server 9.0 to run the Java application the Tomcat server is required and they need to install my SQL database server so that our application can communicate with the database this is environment setup that environment setup we have to do manually devops Engineers has to perform this environment setup manually in order to run our application how many times they have to do this environment setup how many times they need to deploy our application so in the real time we will be having multiple environments guys those are called AS application environments once the coding is completed directly we are not going to deliver that code to the client our application will be tested in the multiple environments like we will have Dev environment we will have sit environment we will have uat environment and we will have pilot environment and we will be having fraad environment so these are called AS application environments Dev environment developers will use this environment for developers integration testing developers will use it use it for developers integration testing all the developers code will be integrated at one place like source code repository server will be available like GitHub or bid bucket in a project there are 10 developers available all the developers code is integrated at one place now once the code is integrated whether that code is working as expected or not we have to test it for that all the developers code will be integrated and that code will be tested by the Developers only for that testing purpose we need one environment called Dev environment what is the meaning of Dev environment a separate platform a separate environment so they need to take one computer install all the required softwares and deploy the application okay so now Dev environment will be used by only developers to perform integration testing then similarly sit environment will be available testing team will use testing team will use will use it for system integration testing developers will do developer integration testing whereas testing team will use it for system integration testing again another environment another environment means again they need to take a computer again install all the softwares to run the application so environment setup to run our application is a difficulty here then what is uat client will use it client side team or client client will use it for accept testing okay so whatever the application we have developed is that application working as expected or not client has to approve that for that we are going to give our application for the client as part of uat uat stands for user acceptance testing so uat is a separate environment client will use this uat environment for acceptance testing then pilot pilot is nothing but pre-production environment okay pre-production environment before our application will be given to the client for in the production environment our application will be tested again in the pilot environment then finally once the pilot testing is completed then we will go for the prod prod is nothing but live environment so end users can access our application from the pra end users can access our application running in fraud fraud environment will be available any application that we are accessing through internet nothing but it is from the fraud environment production production environment nothing but live environment production nothing but live environment so in the real time our once the developers once the developers development got completed once the developers coding got completed our application will be deployed into multiple environments for testing purpose so in the real time for every project multiple environments will be available like Dev environment SE environment U environment pilot environment and prod environment who will use the dev environment Dev environment will be used by developers to perform integration testing what is the meaning of integration testing so multiple developers are working they will work on different different functionalities once the code is integrated all the developers code working as expected or not that is called that verification process is called integration testing okay once the developers integration testing got completed then our application will be deployed intoit environment so testing team will use it for system integration testing sit will be done for our application testers will be available the testers are going to test our application for the testers separate environment will be available uat client will use it for user acceptance testing uat stands for user acceptance testing before going to deliver the project to the client we will give for the trial run client will check is everything working as expected or not once uat completed our project will go to Pilot pilot nothing but pre- production environment before deploying our application to the live environment we are going to deploy the application in the pilot environment okay and the next one is praud praud is nothing but live environment IND users can access our application running in the pr environment now if you see now if you see here there are multiple environments available there are multiple environments are available now in order to deploy our application into all these environments like here Dev environment is available and seat environment is available uat environment is available pilot environment and production environment like that multiple environments are available can you guys tell me what is the environment now so here we need to in install angular okay then install Java and angular also very specific 13 version should be install install Java 17 version then install Tomcat 9.0 install myal 8.5 so this is called environment setup in order to run our application this is environment setup to run our application now this is called as Dev environment so this is one machine in that machine we are installing all the required software then we are going to run our application okay so the same thing the same thing is required when you go for sit environment so again we need to take one more machine in that machine we need to install all the softwares so that is called as sit environment again we need to take one more machine for the uat and we need to install all the softwares in order to run our application in the uat same thing we need to do for the pilot so before giving the project to the customer before delivering the project to the production we are going to do the pilot testing pre-production testing will happen once the testing is completed once the testing is completed in all the environments then finally we are going to take one more machine and we are going to install all the required softwares that is called as production environment so that is called as production environment so in the real time our application will have multiple environments for testing our application will have multiple environments for testing okay so environment nothing but it is a platform where we can run our application guys now if You observe is there any challenge in our application deployment process in the real time is it is there any challenge is there any challenge to run our application in the multiple environments like this is there any challenge or there is no challenge can you see any challenge here or there is no challenge here what is the challenge here what is the challenge that you have observed here can you tell me that will give the answer for what is Docker what is the challenge here H we have to install the required softwares in all the machines wherever we want to run our application okay so today I am having only five environments in the five systems I have to set up all the required softwares and the most important thing is software version conflicts software version conflicts so in the Dev environment already Java already Java 11 version is available but for our application Java 17 version is required there is a chance of getting version conflicts when we are running our application in multiple systems for testing purpose we should be very careful when we are installing the softwares to run our application okay and so to set up this platform set up this environment and manually they are going to install all the softwares humans are going to do this setup there is a chance of doing the mistake there is a chance of doing the mistake now so here the challenges version conflicts can occur version conflicts can occur so whatever the machine I'm taking in order to run my application in that machine already Java 11 is available okay but from our application Java 17 is required okay version conflicts can occur okay so setting up environment environment setup environment setup is time taking process and it is error prone that means a human is going to do this environment setup in order to run our application a human is going to set up a human is going to do all this setup so there is a chance of getting errors so we can do some mistakes also we can do some mistakes also and repeated work setting up the multiple environments is a repeated work and for example tomorrow our application is upgraded from java 17 to Java 21 angular 13 to angular 14 we got some new feutures in the angular and Java new versions I want to migrate my application to angular 15 and I want to migrate my application to Javas 21 then what I need to do we have done all the en onment setup in order to run our application but after three months we got the upgradation request we need to upgrade our application front end to angular 15 or angular 14 and Java version we need to upgrade from 17 to Java 21 then is it easy guys is it easy come on you need to uninstall all the softwares available in all the environments and again you need to install new version of of the software and you need to run your application so that maintenance cost will be high so today I have only five environments for example so we are working on very large scale application we have 10 environments to test our application then can you imagine the scenario now can you imagine the scenario if you want to test your application in the 10 environments 10 computers you have to take in 10 computers you have to set up all the softwares to run your application okay and if any version upgrade is required then the things will become very complex you need to uninstall angular and Java from all the systems and again install the latest version of angular and Java then deploy the application then test that application is working as expected or not so here is there any guarantee the application which is working in one system will execute in all the systems in the same way is there any guarantee the code which is working in one computer in the dev environment can you guarantee that code will work in all the environments no it depends on the softwares we have installed it depends on the platform it depends on the versions of the softwares we have installed then what what issues will occur you know in the real time developers will say that the code is working in my system properly testers will say that the code is not working in our system then in the dev environment whatever the code is working as expected the same code is not working in the sit environment then the fighting will happen between the developers and testers developers will blame the testers testers will blame the developers so these are called environmental issues these are very common in the real time the code which is working in the dev environment the same code is not working in the sit environment the reason environment issue not the code issue sometimes code issues also will be available we have to accept that most of the times when we are going for the environment we should be very careful about the environment setup in order to run our application so this is the biggest challenge this is the biggest challenge in the real time to test our application are you guys able to understand so we are trying to understand that a application will be available application contains three layers front end will be available back end will be available and database will be available so we need to use one database one backend technology one front end technology to develop the application so here I'm taking example my project front end is developed by using angular back end is developed by using Java and mySQL database we are using so that is called text tack of the application here I have decided the application text Tack and Ang 13 version I'm using for the front end Java 17 version I'm using for the back end MySQL 8.5 version I'm using for the database okay and in order to run this application I need a tomcat server that Tomcat server I'm using 9.0 version to run the Java web application Tomcat server is required I'm using Tomcat 9.0 okay guys then once the application development is completed in the developers systems all the code is integrated now as a devops engineer we need to integrate that code and we need to deploy that code into multiple environments first of all what is environment environment nothing but a platform where we can run our application right in the companies multiple environments will be available in order to run our application how they will do environment setup so they will take one machine that can be a physical machine or a virtual machine then they will install required softwares for our application front end is angular 13 version back end Java 17 version comat server 9.0 version database 8.5 version these softwares should be installed in the machine in order to run our code these are called as dependencies of our application okay so in my application code is available in order to run that code angular 13 version should be installed in the computer Java 17 version should be installed in the computer server 9.0 version should be installed mySQL database server 8.5 version should be installed can we call these things as dependencies of our application can we call them as dependencies of our application yes we can call them as dependencies of our application so the the deployment team the operations team should set up all these dependencies in the system to run the application how many places they need to set up these dependencies that depends on Project to project okay so in the real time for every project multiple environments will be available like Dev environment C environment uat environment pilot environment and prod environment okay so SE Dev environment seat environment uat pilot and prod got my point here who who will use this Dev environment Dev environment will be used by developers Developers will use it for integration testing all the developers code should be tested at one place for that they will use this Dev environment testers should test our application for that we will have a sit environment that is system integration testing U client will use it for user acceptance testing okay pilot pre-production environment before deploying our project to the production we will use it we will test it in the pilot environment we'll test it in the pilot environment fraud prod is a live environment end users can access our application running in the production environment now environment setup is a challenging task guys challenges challenges in deployment process can you tell me what are the challenges in the application deployment process so once the code is completed direct directly we are not going to deliver that code to the client our application should be tested in the multiple environments okay challenging in the deployment process the first thing is environments setup environments setup is the first challenge okay and setting up setting up required dependencies dependency is nothing but softwares guys so the front end software backend software database software setting up required dependence is is one of the challenging task so setting up envir multiple environments setup it's not one environment in the real time multiple environments will be available we have to set up those environments and we have to set up required dependencies okay version conflicts version conflicts our application requires Java 17 version but by mistake they installed Java 11 version the code which is implemented with Java 17 version will not work with the Java 11 version such kind of version conflicts will occur and the second problem is environment maintenance environment maintenance is another biggest problem okay environment maintenance is another biggest problem when you go for this multiple environments are you guys getting my point so what are the challenges in the deployment process multiple environments set up and setting up the required dependen that means what are the softwares that are required to run our application setting up all setting up all required softwares in all machines in all machines so I have 10 environments okay in the 10 environments I have to set up all these softwares 10 environments are available I have to set up this 10 environments got guys now version conflicts my application requires my application requires Java 17 version but by mistake they have installed Java 11 version then my application cannot work then my application cannot work are you guys getting my point okay tomorrow if I want to tomorrow if I want to change the version then what is the issue then what is the issue guys if I want to change the version then what is the issue h need to uninstall and install environment maintenance okay environmental issues will occur the code which is working the code which is working may not work in the code which is working in one environment may not work in all the environments the code which is working in the one environment may not work in in other environment then teams will try to blame others dreams will try to blame others got my point developers are saying that the code is working in the dev environment properly we have done very good coding the code is working in the dev environment properly but testers are saying that the code is not working in the S environment the reason in the sit environment by mistake they have installed Java 11 version actually our application requires Java 17 version but some mistake happened in the sit environment Java 11 version is installed because of the Java 11 version the code is working the code is not working in the sit environment then the fight will happen between the developers and testers are you clear are you guys clear with my point are you guys clear with my point people who are watching from YouTube live give me a like like for this video and give me a comment people who are watching from YouTube live give me a like for this video smash that like button and give me a comment whether you are able to understand or not perfect so with this we understood what are the challenges that we face in the industry to run our application okay what are the challenges we are facing in the industry to run the application now to overcome all these challenges in the application deployment process we are going to use Docker to overcome all these challenges in the industry we are going to use Docker okay so now we need to understand what is Docker and how Docker is going to to solve these problems first of all before getting into the solution are you clear with the problem that industry is facing are you clear with the problem that industry is facing yes the problem is environment maintenance running our application in multiple systems is very difficult okay running our application in the multiple environments is challenging running our application in the multiple environments is challenging environment setup is going to take time environment setup is going to take time so to overcome this problem we are going to use a concept called Docker okay so now when you go for the docker so let me tell you when you go for the docker you no need to install all these softwares when you go for the docker you no need to install all the software without bothering about the required softwares you can run your application in any computer okay you want to run your application in the 10 computers happily you can run your application in the 10 computers also without bothering about the softwares installation what are the softwares are required what are the dependencies instead of calling them as softwares we will call them as a dependencies in order to run my application angular dependency Java dependency Tomcat dependency my SQL database dependency instead of we are installing instead of we are setting up all the dependencies to run our application Docker will take care of required dependencies to run our application if I use Docker I can run my application in any computer without bothering about the dependencies so you just need to run your application Docker will take care of the setup requ for the application execution so if we don't use Docker you need to set up all the softwares to run the application in the computer in any computer if you want to run the application you need to set up all the dependencies but when you go for Docker Docker is going to take care of everything that is required to run our application Docker is going to take care of everything that is required to run our application are you guys able to follow me are you guys able to follow me what is a Docker it is free it is free and open source software Docker is free and open source software it is used for containerization it is used for containerization okay so Docker is called as a containerization software guys don't get confused kubernetes we are not discussing today we'll conduct a workshop in the upcoming weekends for the kubernetes kubernetes is called orchestration platform Docker is called as containerization platform so we are using Docker for the containerization we are using Docker for containerization what is the meaning of containerization containerization means containerization means package our application code Plus plus required dependencies as single unit for execution that is called containerization so now it's very important we understood the problem now we are going for the solution so the solution is Docker so the environmental issues will be available managing all these environments setting up the required softwares in the all the environments is very difficult for the operations team in the real time so then how can we avoid this problem how can we avoid this problem in order to avoid this problem in order to avoid this problem we are going to use Docker okay what is Docker so Docker is a free and open- Source software why we are going to use Docker Docker is used for containerization Docker is used for containerization what is the meaning of containerization containerization means package our application code plus required dependencies as a single unit for the execution so what is the meaning of that so here let's understand my code is available my application code is available this is my application code done by the developers in order to run this application I need some dependencies what are the dependencies are required I need angular 13 version angular 13 version and I need Java 17 version and I need Tomcat 9.0 version and I need MySQL 8.5 I need my SQL 8.5 okay these all are called as dependencies these are called as dependencies so this is my application code and these are my application dependencies so what we can do by using Docker so by using Docker we are going to package application code Plus application dependencies as single unit we are going to package application code Plus application dependencies as a single unit that single unit is called as a Docker image that single unit is called as a Docker image so whatever the application code is available what are the dependencies that available to run our application we are going to package application code Plus application dependencies as a single unit that single unit is called as a okay image once the docker image is created for the application we can run our application in any computer without bothering about the dependencies now if I want to run my application into one environment called Dev environment now I want to run my application in the dev environment so for the dev environment do I need to set up do I need to set up any softwares or simply I will take the docker image and I will run the docker image do I need to install the software or I don't need to install the softwares guys do I need to install the softwares or I don't need to install the softwares I don't need to install the softwares why I don't need to install the softwares because the softwares installation will be taken care by will be taken care by Docker the software installation will be taken care by Docker okay so now so this is this concept is called as containerization concept guys this concept is called as containerization concept so what is the meaning of containerization containerization nothing but package our application and application dependencies application code Plus application dependencies we are going to package as single unit we are going to package as single unit for the execution application code Plus application dependencies will package as a single unit that is called Docker image once the docker image is created you can take the docker image you can run in any computer so here I having a Dev environment so when I take the docker image when I run the docker image here it is going to create a Docker container so when I run the docker image a Docker container will be created inside the docker container our application will execute to execute our application what are the dependencies are required those the dependencies will be taken care by Docker that means we can run our application in any platform we can run our application in any platform without bothering about the required dependencies now I got a requirement that I want to run my application in the sit environment so as a as a devops engineer what I will do to run the application in the sit environment simply I'm going to set up I'm going to take one machine in that machine I'm going to take the docker image and I will run the docker image when I run the docker image then what will happen when I run the docker image Docker container will be created that's it what about the softwares softwares will be taken care by Docker only so if you want to run your application in the multiple environments what you need to do you just need to take the docker image and you run the docker image you just take the docker image and you run the docker image when you run the docker image it is going to create Docker container so Docker container will execute our application this is our uat environment so similarly I want to run my application in the pilot environment as well as in the production environment then what I will do so I will take a computer for the pilot environment and for the prod environment I will take a computer so here what we need to do just you take the docker image and you run the docker image you take the docker image and you run the docker image so when you run the docker image then it is going to create a Docker container okay so the docker container will be created inside the docker container our application will be executed so this is my pilot environment and this is my frad environment now the application deployment process got simplified or the application deployment process got simplified or not come on guys the application deployment process got simplified or not so earlier we are responsible to install everything that is required to run our application now we are not responsible to install the required softwares who is going to take care of the software installation Docker is going to take care of the software installation now so here the code which is executing in one environment confidently can I say that that code will execute in the other environments also the code which is executing in one environment can we say that that code will execute in the other environments also yes because who is taking care of the software's installation who is taking care of the software's installation are we taking care of the software installation or the docker is going to take care of the software installation Docker is going to take care of the softwares installation earlier we are responsible to take care of the softwares installation now Docker is responsible to take care of the software installation that means so we can simplify we can simplify the application deployment process in the multiple environments so this concept is called as containerization so Docker is free and open- Source software Docker is used for containerization what is the meaning of containerization containerization means package our application code and required dependencies as a single unit for the execution okay so here when it comes to the docker when it comes to the docker so we are responsible to create the docker image we are responsible to create the docker image once the docker image is created we can run that Docker image in any computer once the docker image is created we can run the docker image in any computer without bothering about required softwares okay now my application should be deployed into 20 environments what I need to do my application should be deployed into 20 environments guys what should I do to deploy my application into 20 environments what I should do do I need to install the softwares in all the 20 computers or I just need to take the docker image and execute the docker image do I need to install the required softwares in all the 20 computers or just to take the docker image and run the docker image come on guys just to take the docker image and run the docker image so whenever you run the docker image Docker container will be created what the docker container will do Docker container will run our application with required dependencies so our application deployment process simplified with the docker so now you need to understand life without Docker and life with Docker you need to understand life without docker and life with Docker what is what is our life without Docker as a software engineer guys what is our life as a software engineer if there is no Docker if there is no Docker then what is our life life without Docker for the software engineer we will end up with lot of environmental issues will end up with a lot of environmental issues so if we have Docker happily we can deploy our application in any computer without bothering about required dependencies when I say dependencies here the softwares that are required to run our application we can run our application in any environment without bothering about the required dependencies are you clear now we need to understand the docker architecture sir how Docker will know what softwares are required to run our application okay and if I want to change a version if I want to change a version suppose now Java 17 is available now I want to upgrade my project to Java 21 I want to upgrade my project from angular 13 to angular 14 okay how the version updates can be done by using Docker and how Docker will understand what are the dependencies that are required for our application so we need to understand Docker architecture okay once we understand the docker architecture then I will go for a Docker setup in our machine and I will show you practical examples on the docker then definitely you will enjoy with the docker Workshop today I'm not going to waste your weekend guys so Sunday it's very valuable for the working people so I'm not going to waste your time so I will give you the very very very valuable content as part of today's Workshop definitely you will feel happy for joining today's Workshop the two hours of time that you are going to spend with me today it's very very valuable for you got my point so I respect your time yeah I'm not going to waste that so the only thing is so give me some time so definitely I will make this Workshop beautiful I hope you understood the last one hour whatever we spent so it's useful you feel if you are feeling that you are learning something then that's good you can stay for another one hour with me to understand if you feel the last one hour almost one hour completed if you feel the last one hour is useful then the next one hour is better than the last one hour because practicals we are going to do people watching from YouTube almost 100 people are watching but no likes for the video so if you give the likes I will get more encouragement to do more workshops like this people watching from YouTube so please like this video and give me a comment so please give encouragement if you give the likes then I will understand that you are also enjoying this class well good guys so now let's understand Docker architecture so Docker technically we need to understand how Docker is going to work what is the docker terminology and how to dockerize our applications got it so Docker is a free and open source software that is used for containerization you got the clarity what is the containerization containerization means package our application code plus required dependencies as a single unit for execution so if we use a Docker in the project we can run our application in any machine without bothering about the softwares okay if we use Docker if we use Docker in our project then we can run our project in any system without bothering about without bothering about underlying underlying softwares okay what softwares are available in that which version of the software is available which OS is available okay we don't need to bother about anything you just take the docker image and you run your application in any computer Docker is going to take care of all the required setup right Docker is free and open source it is used for containerization conization means package our application code class required dependencies as single unit for execution that single unit is called as a Docker image okay once the docker image is created for our application we can run that do Docker image in any system we by using the docker image we can run our application in any system without bothering about underlying softwares okay good so Docker architecture guys let's understand Docker architecture good let's understand Docker architecture so when we are talking about the docker architecture first we need to understand Docker file then we need to understand Docker image then Docker registry Docker registry then Docker container okay to understand the working process of the docker so we need to discuss about these four Concepts first one is Docker file second one is Docker image third one is Docker registry and fourth one is Docker container now so see here when we want to dockerize any application when we want to dockerize any application here our application code will be available okay application code will be available developers are going to write the code required for the application application code will be available so this application code we can't execute in any computer because for every application some technical stack dependencies will be available so this application front-end technology backend technology data server so if those dependencies are available then only we can run our application then only we can run our application now what are the dependencies to run this application those dependencies we are going to specify inside one file that is called as Docker file so what is this Docker file Docker file is used to specify the required dependencies to run our applications we are saying that Docker is using used for containerization by using Docker we can run our application in any machine without bothering about the required softwares right how Docker will know what softwares are required for my application that's where Docker file comes into so Docker file is used to specify the instructions for the docker what dependencies are required I want a Linux machine to run my application in the Linux machine I want Java 17 version I want bql database 8.5 I want tomcat 9.0 I want angular 13 so those are the dependencies that are required for our application those are the dependencies that are required for the application what dependencies are required to run our application those dependencies information we are going to provide to the docker by using Docker file we are going to provide that information to the docker by using Docker file once the docker file is available by using the docker file we are going to create Docker image once the docker file is ready so in some projects developers will write the docker file in some projects devops Engineers are going to write the docker file but in my point of view both developers and devops people also should know Docker file creation how to write the docker file how to specify how to specify what instructions that are required to write the docker file okay so Docker file is very very important when we are working with Docker Guys Without Docker file we can't use this Docker got my point Docker file is used to specify instructions required for our application okay by using the docker file we are going to build Docker image once the docker file is available we need to create the docker file I will tell you how to write that also we are going to write a Docker file once we write the docker file by using the docker file we are going to create a Docker image our application code and required dependencies where is our application code so my Java application is available that is packaged as a jarfile or War file so where is that code where is the application code available and to run that application code what dependencies are required we are going to mention in the docker file once the docker file is ready by using the docker file we are going to build Docker image we are going to build the docker image once the docker image is created once the docker image is created that Docker image we can store into Docker Hub guys that is called Docker registry so whatever the docker image I have created I want to use this Docker image in future I want to use this Docker image I want to execute this Docker image in multiple systems so for that what we will do we can store the docker image into Docker Hub this is called push operation so this is called as a push operation whatever the docker image is created we will push that Docker image into Docker Hub so Docker Hub is called as a Docker regist some people will use Docker Hub to store the docker images some people will use jrog repositories Nexus repositories AWS ECR elastic container Registries there are multiple places where we can store our Docker images for future purpose we can store the docker image into dockerhub Docker Hub is called as a Docker registry where we can store the docker images today I have created a Docker image I want to use that image in the future I want to use that image in multiple systems so that's why we are going to store the docker image into dockerhub so it's not mandatory that we should use only dockerhub what are the Alternatives available for the docker Hub you can use Nexus repository you can use jrog repository you can use AWS ECR also to store the docker images you can store the docker image into Nexus repository you can store into jfrog repository you can store into AWS ECR or you can store into dockerhub so in this Workshop I will show you how to store Docker image into dockerhub guys so what is a dockerhub it is a registry where we can store our images okay so once the docker image is created and stored in the docker Hub so this image whatever we are storing in the dockor hub right we can make it as a Public Image or private image if it is a Public Image anybody can take the image they can run our application now our application code and application dependencies will be packaged as a single unit for execution that single unit is called as a Docker image are you getting my point what is a Docker file Docker file contains a set of instructions to specify what dependencies are required to execute our application Docker file contains set of instructions to dockerize our application so basically we'll specify what dependencies that are required to run our application so Docker file is basically used to specify what dependencies that are required to run our application so we are understanding Docker architecture are you guys clear as of now are you guys clear as of now what is Docker file what is the docker image and what is Docker Hub application code will be available to run that code some dependencies are required what dependencies are required we will specify in the docker file by using the docker file we are going to create a Docker image Docker image contains Docker image contains code plus dependencies dependen is nothing but softwares once the docker image got created we can store the docker image into dockerhub Docker Hub is called Docker registry where we can store our Docker images what are the Alternatives what are the alternatives for the docker Hub guys can you tell me what are the alternatives for the docker Hub can anyone tell me instead of storing instead of storing Docker images in the docker Hub what are the Alternatives available for that what are the Alternatives available for that what are the Alternatives available for that not GitHub Docker image we can't store in the GitHub GitHub is used to store the project code giab is used to store the project source code but not Docker images okay we have Nexus repository we have Nexus repository we have jrog repositories Nexus repository available ailable jrog repository is available and AWS ECR is available to store the images got it now once this Docker image got created we can pull the docker image and we can run the docker image you can run the docker image in multiple computers okay so this is computer one where I can run my Docker image so like this once the docker image got created you can take the docker image and you can run the docker image in multiple systems you can pull the image and you can run the image in any system so whenever you run the docker image it is going to create whenever you run the docker image it is going to create Docker container whenever you run the docker image it is going to create a Docker container now this process is called run run the docker image so in which computer you want to execute your application in that computer you pull the docker image that means you pull the docker image and you run the docker image okay so in whichever the computer you want to run your application so you just need to pull the docker image and you need to run the docker image so when you run the docker image what will happen when you run the docker image it is going to create a Docker container when you run the docker image it is going to create a Docker container so what is the meaning of Docker container Docker container is going to run our application okay so code and dependencies are available right so those things are going to run so once the image is created we can run multiple containers once the docker image is created we can create multiple containers and we can run our application so I have some Dev environment okay and I'm having some sit environment Dev environment is available and I'm having seat environment my Dev environment and my seat environment is available I can take this Docker image and I can run this Docker image so wherever I want I can run my Docker image Dev environment and sit environment then next one similarly uat environment are pilot or prod wherever you want to run your application wherever you want to run your application you just need to take the docker image and you need to run the docker image this is called as Docker architecture this is called Docker architecture are you guys clear with the docker architecture what is a Docker file Docker file is used to specify instructions to dockerize our application so where is the code what dependencies are required that we are going to specify now tomorrow when I want to change any Java version or angular version do I need to change everywhere or I just need to change in the docker file I want to change from java 17 to Java 21 where I need to change that guys where I need to change that I want to change the Java version where I need to change that do I need to change in all the systems do I need to change that in all the systems not required right I will change in the docker file and I will create the docker image so whenever code changed and whenever your version changed you need to recreate the docker image and you need to rerun the docker image that's it you need to recreate the do suppose I specified that I want Java 17 now today I want Java 21 then I will change my Docker file I will change the instruction in the docker file I will rebuild my Docker image then I will rerun my Docker image when I run my Docker image Docker container will be created so where our application code and application dependencies will be available guys where our application code and application dependencies will be available application code and dependencies will be packaged as a single unit what is that single unit is called what is that single unit is called application dependencies and application packages will be available application code and dependencies will be available as a single unit what is that single unit is called what is that single unit is called that single unit is called as Docker image Docker image to to create the docker image what is required to create the docker image what is required to create the docker image what is required to create the docker image we need a Docker file and where we can store the docker images where we can store the docker images Docker images we can store in the docker registry we can use a docker to store our Docker images okay and once the docker image is available you can take that image and you can run that image in any system when you run the docker image Docker container will be created when when you run the docker image Docker container will be created okay so inside the docker container our application is going to execute inside the docker container our application is going to execute now the only thing that you need to do is in in order to run Docker image in any system we need to install Docker software install Docker okay so once you if you want to run the docker image you need to install the docker software in any machine so now I want to run my Docker image in the I want to run my Docker image in the dev environment so to run the docker image you need to install the docker software then you can run the image now I have I have 30 environments for my project so in the 30 environments I want to run my application what I need to do just install the docker then pull the docker image download the docker image and run the docker image that's it that's it so tomorrow if I want to change some code if I want to change some code if I want to change some dependencies I will edit my Docker file I will recreate the docker image then I will rerun the docker image when I run the docker image Docker container will be created guys now I have a question once I create the docker image once the I once I created the docker image using that image can I run my application in multiple computers using the docker image can I run my application in multiple computers yes you can take that image and you can run that image but what is required to run the docker what is required to run the docker image in your system what is required to run the docker image in your system Docker software you just need to install the docker software then you can run the docker image when you run the docker image what will happen Docker container will be created what is Docker container inside the docker container our application is going to execute now if you see the official logo of the docker if you see the official logo of the docker it is a ship symbol with boxes why they have given ship with boxes these boxes are called as containers easily we can transfer our containers from one place to another place that means Docker images Docker containers are easily shippable symbolically they're representing in the logo this is the logo of the docker so the docker logo is a ship with containers so that means easily we can ship our containers easily we can run our containers in any machine easily we can transfer them so Docker is platform independent you can run the docker image in the Windows machine you can run the docker image in the Linux machine also Docker containers we can execute in the windows as well as in the Linux also there is no restriction there is no restriction Docker is platform independent why it is a ship with boxes the logo ship with boxes easily transferable easily transferable good so we understood Docker architecture what is a Docker file it contains it contains a set of instructions to dockerize our application it contains set of instructions to build Docker image where is the code what are the dependencies where is the code what are the dependencies required to run that code we are going to specify by using Docker file it contains set of instructions to build the docker image and next one is Docker image it is a package it is a package which contains code plus dependencies so what is the code and what are the dependencies that are required will be part of Docker image to create the docker image Docker file is required Docker file contains a set of instructions to build the docker image Docker image is a package which contains code plus dependencies Docker registry it is a place where we can store our Docker images Docker Docker Hub or Docker registry it is a place where we can store our Docker images for example Docker Hub is a registry where we can store Docker images Docker container okay when we run the docker image when we run Docker image then Docker container will be created when we run the docker image then Docker container will be created our application our application will execute inside Docker container our application will execute inside Docker container okay guys so this is about Docker architecture guys Docker internally uses virtualization guys Docker internally uses virtualization sir what is that Docker virtualization now here my Docker image is available so assume that this is is my Docker image when we run the docker image what is going to happen that is very important to understand okay so Docker containers Docker containers will use virtualization concept what is the meaning of that virtualization so here I have a computer so assume that this is my machine this is my machine it can be a Windows machine or it can be a Linux machine in my machine I'm having poost OS okay this is my windows I'm using Windows in my laptop okay so Windows OS is my main operating system this is my host operating system I have a computer in to use a computer operating system is mandatory okay so this Docker image is available in the docker Hub assume that so this is our Docker Hub inside the docker Hub Docker image is available that is Java application Docker image Now by using this do Docker image I want to run my application application code Plus application dependencies are available in the docker image the docker image is stored in the docker Hub now I have my computer my laptop is there in my laptop I need to run this Docker image okay so in my computer one operating system is available that operating system is called host operating system so in in this host operating system to run the docker image what we need to do we need to install Docker engine so in order to run the docker images first you need to install Docker engine so Docker engine is nothing but Docker software in order to run a Docker image in our system you need to install Docker engine once we install the docker engine then we can pull the docker image and we can run the docker image pull means download run means execute okay pull means downloading the docker image once the docker image is downloaded to our system then we can run the docker image when we run the docker image then Docker container will be created whenever we run the image Docker container will be created let me call it as a C1 container one and I run the same image again when I run the same image again add a different image okay then another container will be created this is called container two when I run the one more image then what will happen another container will be created like this in one machine can I run multiple containers in one machine can I run multiple containers guys yes that is possible so same image you can run multiple times so that three containers will be created or you can run three different images then three different containers will be created okay so what is this container this container is a Linux virtual machine okay so our application will run in the different machine it is independent from our host operating system so my machine is available my machine is having Windows operating system in my machine no Java no angular no Tomcat no my SQL database but still I can run the application as a Docker image inside the docker image code is available required dependencies are available what I will do I want to run this Docker image in my system then I'm going to install docker software in my system only Docker I will install that's it I will not install Java I will not install python I will not install Tomcat database angular nothing so my machine is just a machine with only operating system in this machine I will install the docker software okay once the docker software is installed in my system then I can pull the docker image pulling the docker image nothing but downloading the docker image okay so I can once the docker is installed in my system I can create the image in the same system or I can pull the images which are already available I can pull the docker image and I can run the docker image when I run the docker image what will happen it will spin up a virtual machine in our operating system that is called virtualization Docker internally uses virtualization concept so every container is a Linex ma guys every Docker container that you are creating is a Linux virtual machine where the required softwares will be available so in our machine one container will create container is one virtual machine inside that container machine we can see that container machine practically I will show you that also so one virtual machine will be created inside that virtual machine our code will be copied the softwares will be installed and our application will be executed okay so in our machine container will be created container is a virtual machine are you guys getting my point are you guys getting my point how the docker is going to manage the softwares and what is a container so in the Layman terminology container means one virtual box you can say one virtual machine if I run the image for three times then what will happen three containers will be created so three containers means three virtual machines will be created on the fly when you delete the container when you delete the container that virtual machine will be deleted when you delete the container that virtual machine will be deleted okay so can I say Docker is containerization software based on the virtualization concept come on guys can I say Docker is a containerization software working based on the virtualization yes what is the meaning of virtualization what is the meaning of virtual ization running one machine in another machine running one operating system in the another operating system is called as a virtualization Docker will internally use that virtualization to create the containers container means what it is a box okay so inside that virtual machine what will be available what softwares will be available in the virtual machine guys what softwares will be available inside the virtual machine the required softwares to run our application okay the virtual machine contains the required softwares to run our application how this virtual machine will know what softwares are required they are already mentioned as part of image how that image is created that image is created by using Docker file what will be there in the docker file set of instructions to build the docker image you got it you got it what is a container come on with one image with one image we can create any number of containers there is no limit with one image we can create any number of containers with one image we can create any number of containers container means container means virtual box container means virtual box got it so containers are created based on virtualization containers created based on virtualization so in one machine we are going to run other machine okay the host machine virtual machine both are independent so you don't need to install any software in the host machine because Docker will take care of the softwares in the virtual machine every container is a virtual [Music] machine are you clear yeah Docker Docker is a containerization software Docker is a containerization software what is the meaning of containerization packaging the application and application code as a single unit for the execution is called as a containerization so what is the benefit with the containerization if you use a containerization then we can run our application in any system without bothering about underlying softwares Docker architecture so Docker file Docker file contains set of instructions to build Docker image okay so when you are working with the docker Docker file is very important Docker file contains set of instructions to build Docker image then what is a Docker image Docker image is a package which contains code plus dependencies Docker registry it is a place where we can store the docker images Docker container when we run the docker image then Docker container will be created our application will execute inside a Docker container every Docker container is one virtual machine every Docker container is one virtual machine which will be created on the host machine every Docker container is one virtual machine which will be created on the host machine okay in order to work with the docker then we need to do Docker setup okay guys today I'm going to show you Docker setup in the Linux machine I will take one Linux machine in the AWS cloud and I will do the setup because in the the real time we will use Linux boxes to perform our application deployment operations you can install the docker in the windows also but in the real time we don't use Docker in the windows we are going to use Docker in the Linux machines okay good clear let me go to Docker setup so to do the docker setup I'm using my AWS account in the AWS account every developer should have AWS account cloud is very important nowadays you need to explore the cloud if you are new to the AWS part guys so I have done one crash course on the AWS I have done one crash course on the AWS within 30 minutes you can uh understand what is AWS within 30 minutes you can understand what is AWS how to create the account in the AWS how to practice that I have done one AWS tutorial AWS Cloud tutorial so three months back I uploaded one video so here I explained what is AWS how to create the account in the AWS okay how to create virtual machines in the AWS Cloud so anyone uh who want to explore the cloud the cloud is the future for the software guys so it's very very important so I have shared that video in the chat box and I will share that in the WhatsApp group also so just go through that video so in that video you will understand uh several important topics what is cloud how to work with AWS Cloud how to create account in the AWS Cloud these are the things I explained in this tutorial within 30 minutes you can understand what is cloud why what is AWS what services available how to set up the account how to create virtual machine how to do the database setup in the cloud how to do website hosting in the cloud how to do the domain mapping in the cloud these topics I explained within 30 minutes the basic Cloud information it's very very important for everyone to know about the cloud good so after the session I will share this video as well please go through that now I want to do the docker setup okay so to do the docker setup set of steps I have given in my GitHub repository so Docker setup is available in the GitHub I have given this Docker setup document so login into AWS cloud account and create one virtual machine and connect to that virtual machine using mobile extr then by using these commands we can install the docker software and we can verify Docker is installed or not first let me complete the step one set up Linux machine in the AWS and connect to that machine using mobile exr good go to ec2 ec2 is a service in the AWS Cloud which is used to create virtual machines good I'm trying to login into my AWS account good I logged into AWS cloud account so currently you can see in the AWS Cloud I'm operating from the Mumbai region currently I don't have any instances instances count is zero let me go and click on launch instance so I'm giving this as Docker VM I'm taking one virtual machine with Linux operating system for that I'm giving the name as Docker VM I'm creating this machine by using Amazon Linux Ami what is Ami and all you can see in that AWS video guys T2 micro I'm using which is free to eligible this machine is free of cost for one year key so I don't have any key pair let me create a new key paay I'm creating the key pair as Docker Workshop Keir in order to connect with the machine this key pair is required click on create key pair when I click on the create key pair that key pair is downloaded into my system so that key pair is used to connect with that machine okay Docker Workshop Keir I have created default VPC we are using Security Group I'm going with existing Security Group then that's it so I am taking one virtual machine Ami is Amazon Linux and T2 micro instance one key pair I have created just now no need to change any network default VPC Security Group I'm selecting existing if you want you can create the new Security Group then simply click on launch instance with this my machine will be launched successfully initiated the launch of the instance one virtual machine have created in the AWS Cloud so we need to wait till that machine turns into running State still it is in the pending State the machine will come into running State once the machine is in the running State then we can connect to this machine by using mobile exam or by using puty in the video I have explained that part also how to connect with the Linux machine by using mobile extrom Let me refresh yes my machine is started it is in the running state for this machine public IP will be available copy this public IP and connect with the machine so I'm using mobile exam software it is also free to connect with the Linux machins go to mobile exam session Linux machines Works based on SSH connection click on SSH remote host I'm giving my public IP my machine username is default username easy to user password will be available private key will be available we have selected pem file select that pem file okay so go to this PC downloads in the downloads I have that P file just now we created a pem file select that pem file click on okay so with this I'm able to connect with my Linx machine successfully now you can check it to Mi I I connected as a easy to user good next we need to install the docker before that let me check Docker i v what it is saying guys when I use Docker i v it is saying Docker command not F so in this machine Docker software is not available just I completed step one that means I created a Linux machine and I connected to that Linux machine using mobile exr now I want to install Docker in the Linux machine so for this the commands are available here so just copy these commands and execute sudam update it is used to update the existing packages nothing to do because it is a latest Mission all the packages are up to date so this is the command which is used to install the docker sudam install Docker iPhone y it is going to install Docker software in this Linux maion why we are installing the docker software to create the images to run the images Docker software is required Docker installation got completed then let's start the docker as a service Pudo service Docker start so Docker start created Docker start is done then after very important step guys we installed the docker now we connected to this machine as a easy to user now Docker is installed when the docker is installed Docker group will be created so now I want to perform operations in this machine as a e to user so that's why we are going to add this e to user to Docker group it is a user mode command in the Linux which is used to add this user to Docker group when you install the docker Docker group will be created but we want to perform the operations as easy to user in the Linux machine so that's why I'm adding easy to user to Docker group so that we can perform Docker operations okay once we add the e to user to the docker group just type exit just close the session and reconnect to that session I have given exit then press R to restart the session once the session is restarted then you can execute Docker iPhone V now you can see Docker version 24.05 is created okay so with this Docker setup got complete so in my Linux machine Docker setup got completed so we can verify the docker info when you execute Docker info it will show you the information currently how many containers are available zero Docker client is installed and debug mode Falls containers zero images zero okay currently nothing is available it is a brand new machine in this machine we have installed Docker okay now in order to work with the docker we need to know some Docker commands Okay Docker setup I have given a git repository guys so let me share the git repository link here in the notes I'm giving this git repository so when you access this URL in the browser then you can see the steps okay so this is the git repository link to set up the docker in your system once the docker setup got completed then in order to work with the docker we need to use some Docker commands we need to use some Docker commands sir what are the commands the first one is Docker images the first command is Docker images to display to display list of doer images available in our system okay Docker PS to display list of to display list of Docker containers running in our system okay Docker images is a command it is used to display the images which are available in our system Docker PS to display list of Docker containers running in our system so let me go and execute a command called Docker images now when I executed Docker images is there any image available in our system guys please involve for the next 30 minutes practicals very very very very important people from YouTube people from YouTube are you able to follow are able to follow from the zoom guys able to understand it's very very very very important workshop and very useful you are getting for free of cost please be active for the next 30 minutes because practicals we are doing on the docker theoretically we understood we got the clarity now practicals also if you you understood then happily you can keep Docker in your resume got it so I want to check what are the docker images available in my system I have taken a Linux machine so in this Linux machine I have installed Docker software I have taken a Linux machine in this machine I have installed Docker software now in order to work with the docker we are using Docker images okay Docker images is a command what is the purpose of the docker images command it will display what are the images available in our system currently is there any image available or there is no image available in our system currently any image available there is no image available in our system currently there is no image available in our system okay can we check any container is running in our system Docker PS now any container is available in our system no container is available in our system so now what we need to do now what we need to do guys we need to download the image and we need to run the image we need to download the image and we need to run the image in order to download any image okay so here you can use a command called Docker P command with the image name or image ID image ID or image name you can use to download to download Docker image Docker pull image name or image ID then Docker run you can use image ID or image name to run Docker image container creation so whenever you want to download any Docker image you can go for Docker pull command so Docker pull command you can pass Docker pull command with image ID or image name so it is going to download a Docker image once the docker image is downloaded you can run the docker image whenever you run the docker image whenever you run the docker image it is going to create a Docker container okay so if you want to stop if you want to delete the image Docker RMI Docker RMI image ID or name so when you give image ID or name for the RMI command to delete Docker image okay to delete the docker image you can go for that Docker RM container ID okay to delete Docker container to delete Docker container like this there are several commands available on the docker okay right Docker images Docker PS Docker pull Docker run Docker RMI Docker RM okay now sir where we can find the docker images where we can find the docker images that's where Docker Hub is available you can go to dockerhub in order to understand the Docker image names image IDs so everyone can create the account in the dockerhub so dockerhub is available where you can find the images for example I want to run my SQL database what is the image name for that you can find out in the dockerhub login. do.com it is a dockerhub if you don't have a account you can sign up so my username and my password I have already account in the dockerhub so as part of our batches we are using Docker in our spring Boot and project batches in the devops so we are using Docker so I already created a account in the dockerhub and I stored lot of images in the dockerhub so you see one of my image I created for spring boot image you see how many people downloaded my Docker image 67,000 people downloaded my Docker image so once I create the docker image and upload in the docker Hub anyone can pull my Docker image and they can can run my Docker image so this is a spring boot application rest API so they are they are pulling my Docker image 67,000 people pulled my Docker image because it is a Public Image and they are running my Docker image so this is the name of my Docker image two years ago I pushed this Docker image into dockerhub as of now these many people pulled my Docker image and they are using my Docker image okay good so these are this is my dockerhub account all these are my Docker images which I have stored so I have stored one Java web application image 3,500 people pulled that similarly I have stored python images angular images python plask application I have stored here so many Docker images I have in my Docker Hub got it f that's fine so here I want to search for the docker images okay so you need to create the account and login into dockerhub search for the dockerhub you can search for the image I want to go with first hello world Docker image just a basic application okay so there is a Docker image with a name called Hello wall okay so one billion people one billion one billion people downloaded this Docker image this is official Docker image okay you can create the docker image for your application and Docker is providing some predefine images also you can create your own image and you can pull the do images which are already available okay so go to hello world image what is the name of the image hello world they giving the syntax also Docker pull hello what is Docker pull Docker pull is a command which is used to download the image what is the name of the image hello world you just copy this then go here before I'm going to execute this command let me show you Docker images nothing is available now I'm am using using Docker P hello now enter it is going to download a image with a name called hello world now you see Docker pull hello world image I have downloaded using the default tag pulling from the library and pull completed status downloaded a new image for the hello so from the docker io. Library it pulled hello world image after pulling the image you can check Docker images now you see there is a image with a name called hello world this is image ID five months ago this is created and size is 13 KB I have the docker image once the docker image is available can we run the docker image guys once the docker image is available can we run the docker image what is the command to run the docker image Docker run image ID or image name use check it Docker run Hello wall that is the name of the image image name Docker pull to download the image Docker run to run the image when you run the image what will happen Docker container will be created okay H world is a just a basic image which will give you H World message enter right so when I execute Docker run hello world it is giving a message hello from Docker that means that image is executed container created and container has given a message this message shows that your installation appears to be working correctly boss your Docker setup is successful in the system and you are able to run the docker image and you are able to create the docker container so how it is working in the background they have given some steps could you please read these four points you will understand what happened in the background could you please read these steps so that you can understand what happened in the background come on guys you understand what happened in the background the docker client so in our machine we have installed Docker right in our machine we have installed Docker so what happened Docker in is available so that is going to install Docker client okay so once we install the docker Docker client will be available Docker client contacted the docker demon Docker demon is a background process that is available in our system the docker demon pulled the hello world image from the dockerhub the docker demon created a container from the image which producing the output Docker demon that means whenever you execute any Docker command Docker client will contact the docker demon Docker demon is a background thread which is going to do all the docker operations okay good so you got the concept how to check the images Docker images there is one image available Docker PS no containers are running Docker PS iPhone a it will display the containers which are stopped also Docker images command will display what all the docker images are available docker PS command will display the containers which are in the running State the docker PS iPhone a it will display the containers which are running as well as stopped so there is a container which is stopped exited status is exited so whenever I execute Docker run hello world it is a standalone application image okay it is just producing hello from Docker then it is stopping the container right so how to check the containers which are stopped by using Docker p s iPhone a okay see here I executed image for two times so container created two times and it got stopped one container stopped 3 minutes ago another container stopped 11 seconds ago two times I have created that image okay good now how to delete the container guys how to delete the container Docker RM container ID Docker RM container ID okay so it is used to delete the container which is in the stopped State now I have deleted the container do PS iph a all the containers got deleted now Docker images available so Docker images there is one image available how to delete the image Docker RMI image name or image ID anything is fine I have deleted my Docker image RM command to delete the container with the container ID RMI command to delete the image with the image ID okay so now you see Docker images everything is cleaned in my system nothing is available I pulled one image I executed that image container got created now I stopped it okay I deleted the container and I deleted the image also are you able to follow me what are the commands that we used as of now Docker images command to to display list of Docker images available in our system Docker PS to display list of containers running in our system Docker pull command to download a Docker image Docker run command to run the docker image Docker RMI command to delete the docker image Docker RM command to delete Docker container are you clear now sir why this container got stopped that is hello world image now that's why it got stopped okay if you run any web application that container will not be stopped whenever you run any web application image that container will not be stopped it is allo is a basic image okay and one more thing that we need to understand here earlier I used Docker pull hello then after I executed by using Docker run hello instead of this full command directly I will use Docker run Hello wall but currently in my system Docker image Hollow world is available or image Hollow world is not available guys in my system Docker image is available hello world are not available it's not available then what will happen when I execute this run command then what will happen when I execute this run command guys what will happen when I execute this run command image not P or it will pull and run the image uh you need to understand Docker is intelligent here guys Docker is intelligent here whenever you execute run with image name first it will check for the image in the local unable to find the image locally whenever you execute Docker run hello unable to find image locally first it is giving the priority for the local images if the image is available in the local then it will pull that image and it will run that image so first it is checking in the local if the image available in the local it will use that image and it will create the container but in this scenario the image is not available in the local so that's why it is going to download that image then it is going to run the image so do we need to pull is it mandatory to pull to run or directly you can run also now you can tell me is it mandatory to pull the image to run or directly we can execute run command it's not mandatory to pull directly we can execute when we execute directly then what is happening when we execute directly then what is happening it is checking in the local it is checking in the local if available run if not available then pull and run you got it got my point okay very good so now Docker images available one image is available and Docker PS iphon a container is in the running state or container is in the stopped State container is in the running State our container is in the stopped state in the stopped State okay can we delete the container which is in the stoed state yes we can delete it what is the command Docker RM container ID what is the command to delete the image RMI here we can do one more thing Docker system prune iPhone a when I execute Docker system prun iPhone a all stopped containers unused images will be deleted in the single shot I want to clean up my system all stopped containers all unused images I want to delete Docker system prune iPhone a so this will delete all stopped containers all networks all images without any container Association will be deleted yes yes so now see 13 KB space Rec l so it deleted stopped containers and unused images Docker system prun iPhone a which is used to clean up our Docker server okay delete clean up clean up I mean it is going to delete delete stopped containers and unused images if you were image is not associated with any container then that will be deleted let me save this file guys so after the class I will share this notes okay so I have shared the WhatsApp group link right in that WhatsApp group you will get this notes okay good yeah so you understand what is the purpose of do system prun iph a guys you understood what is the purpose of Docker system prun iph a what is the purpose of Docker system prun I a to delete all the stopped containers and unused images to delete all the stopped containers and unused images we are going to do this for YouTube viewers also I'm going to share WhatsApp group Link in the live chat you can check that and you can join the people who are watching in the live you will get that in the chat box Okay one minute after the class this notes and this video you will get it yeah for the live people in the live chat the people who are watching from YouTube I have given WhatsApp group Link in the live chat box you can join in that so that you will also get the notes and document okay good fine so we understood the docker commands now for example I want to run a Docker container for the image which is already available so we want to understand how to run the existing Docker images and how to create a Docker image for our application both we are going to understand okay so both we are going to understand perfect now Here If You observe I have shown you one of my famous Docker image which is spring boot rest API okay so spring boot rest API is available I want to take this image and I want to run this image okay so what is the command Docker pull image name so this is the command in order to run this Docker image Ashok it/ spring boot rest API this is my Docker image so I can first pull this image and I can run this image instead of pulling can we run directly also guys instead of pulling can we run directly also is pull mandatory is pull mandatory or is p optional is p mandatory or is p is optional optional right directly you can execute run command but here let me show you how to pull this clear currently in my system no images are available no images are available and can you check is Java installed in my system guys is Java installed in my system or Java is not installed in my system Java is not available spring boot application is a Java based application to run the spring boot application Java is required but do I need to install the Java to run my spring boot application here which is available as a Docker image not required right not required right huh so just to pull the image Docker pull Ashok it spring boot rest API this is my image name Ash SL springbot rest API execute is going to run a Docker image it is going to pull the docker image guys yes the docker image is downloaded from dockerhub you can also pull my Docker image because this Docker image is a Public Image available in my Docker Hub account so this is a Public Image anybody can pull this Docker image once the docker image got pulled you can verify whether image is available or not docker images can you check it so 23 months ago I have created this Docker image around two years almost two years back I created this Docker image as it/ springboard rest API is my image name now can you tell me the command to run this image this is my spring boot application which I have dockerized how to run the image what is the syntax Docker run either you can take image name or you can take image ID I'm using Docker run image ID now you check it what is happening wow it is running our spring boot application is it running our spring boot application or not but do we have Java in this machine do we have Java in this machine no then how how this spring boot application got executed how the spring boot application got executed Docker is taking care of that to run my application Java is required uh so what I have done for this project for this project I have created a Docker file my spring boot application code is available for that I have created a Docker file using the docker file I created a Docker image the docker image I have stored in the dockerhub now from the docker Hub I am pulling the image and I running the image when I run the docker image Docker container is created inside the container my app application is executing now sir can we access this application which is running in the docker container can we access this application which is running in the docker container no the answer is no at this moment at this moment you cannot access this application running in the container the reason is virtualization so this is my Linux machine so my machine is available The Host is Amazon Linux okay I have a machine in this machine I have Linux operating system I created a Linux machine in the AWS cloud and I connected to this Linux machine by using mobile extrom then in that machine I have installed a Docker then by using Docker I pulled a Docker image using this Docker image I created a Docker container so Docker container means what Docker container means means what guys talker container is a virtual box now so in one Linux machine another another Linux machine is running I know IP address of my Linux machine I know IP address of my Linux machine so which is which is the public IP of my machine but application is running in my machine the application is running in my machine the application is running in the docker container guys the application is running in my machine the application is running in the docker container come on first the application is running in my machine or it is running inside the container it is running inside the container so is there any relation between is there any relation between this container and this host machine as of now is there any relation between the container and host machine there is no relation there is no relation that's the reason you cannot access that rest API that is the reason you cannot access that rest API okay I have taken one machine in that machine Linux operating system is available that's okay in that machine I installed Docker fine by using that Docker I downloaded a Docker image and I executed a Docker image when I execute the docker image Docker container got created Docker container got created but is there any relation between my machine and that Docker container is there any relation between my machine and that Docker container or there is no relation no there is no relation got it so then how we can access the rest API which is running in the application which is running in the docker container ah this is not the right approach to run the container to access it outside this is not the right approach to access the container outside if you want to allow the people to access your container outside you need to go like this doer pull iph P 808 colon 88 SL docker do Docker run basically Docker run iph P 808 col 8080 and our image name so what is this iphon p iphon p is called Port mapping I need to establish the relation between I need to establish the relation between this container machine and this host machine my container is running on the port number 880 so I want to map that to the 880 Port okay container Port is 8080 poost Port also I am mapping to 8080 so if you establish the port mapping then we can access our rest API by using host to machine public IP So currently my container is running but that container is running inside the virtual machine we can't access outside because we don't know what is the IP of the virtual machine so virtual machine is created inside the host machine I know the IP address of host machine but but my application is not running on the host machine my application is running inside the container container means virtual box I don't know address of the container then what I will do I will establish the relation between container machine and host Machine by using Port mapping so for that we will use a flag called iph p iph p represents Port mapping so when you are running your Docker container you need to specify Port mapping then you can access this application outside by using host machine public IP you understand what is the purpose of the port mapping it is used to establish the relation between host machine and container okay so host machine container relation what is the port number it is using guys my container using port number my springboard application running on the port number 9090 you can see here comcad server started Swit port number 9090 Java developers spring boot will use Tomcat as embedded container with default port 8080 but for this application I changed the port number to 9090 so what is my container port number 9090 so what I will do that 9090 I will map to 9090 my host machine also so host port and container Port we are going to do if you run application like this then you can access that application outside let me do let me stop the container contr C which is stopped now let us check it Docker PS iph a my container stopped 4 seconds ago it is exited okay now let me do Docker system prun iph a delete everything I don't need anything delete it now Docker images Docker images no images are available Docker PS iph 8 nothing is available okay now let me go and execute my image create a container when I am running the container by using a Docker image I'm doing the port mapping the container is running on the port number 9090 Post Port and container Port is available so if you do the port mapping then we can access our rest API outside Docker run iph P 9090 col 9090 poost port and container port and this is is my Docker image name so P I'm am not doing directly I'm going for run so it will check in the local if you available it will run that if not available it will download and it will run that so before once again I'm going to show you in my system Java is available or not in my host machine Java software is available or Java software is not available in my host machine Java software is available or Java soft Ware is not available Java software is not available okay just run the image Docker run Docker run iph P 9090 colon 9090 slash image name so this is name of the image Public Image in the docker Hub now run this unable to find the image in the local now it is pulling that image from the Docker Hub and it is going to run that Docker image you can see the console my spring boot application getting started it started with the port number 9090 I mapped that to the poost port 9090 now so here now be careful we have created one container that container Port is 9090 that container Port we map to post Port Port mapping we have done because I want to access this outside okay I know the public IP of my machine this is my machine public IP my Linux machine public IP which is running in the AWS cloud in that Linux machine Docker is installed using Docker I executed a Docker image Docker container created for that container I have done the port mapping now to access our rest API from this machine access rest API from this machine what we need to do first we need to enable the port number in the security group okay so for this machine go to security tab at the time of creating this machine we used one Security Group go to that Security Group edit the rules custom TCP 9090 I have enabled I have mapped this machine to I have mapped this container to 9090 host okay so you need to go to the security group inbound room and enable 9090 okay so in the AWS video I explained what is the security group and all that stuff guys so currently I'm enabling 9090 the reason my container machine my container running on the 9090 in the hostport I have M to 9090 that's why I'm enabling 9090 in the security group inbound rule save the rules that's it so we are good now we can access our rest API which is running in the docker container so this is my machine details go to public IP go to public IP go to browser public IP colon 9090 welcome John you give the name now see here so this is my rest apia URL pattern welcome John is the name that is expecting as a path parameter if I give any name for that name it will say a great message welcome to Ashok right so if I give my name as ashoke it will give ashoke welcome to asop so this is the URL of my rest API so where is this rest API URL where is this rest AP is running can you hit that URL give your name in the URL and test it and let me know are you able to access my rest API which is running in the docker container that is available in the Linux machine the people in the zoom I gave the URL for testing purpose are you able to hit that are you able to hit that URL give your name and try that is it giving the dynamic response from where you are getting the response ah it is working that's awesome right so now now if I want to run this application in the 10 environments if I want to run this application in the 10 environments do I need to bother about softwares if I want to run this application in the 10 environments do I need to bother about the softwares require right so what what you need to do if you want to run this spring boot application in the 10 environments then what we need to do come on guys just install the docker software and run the docker image install the docker and run the docker image so that your application will execute in any ma okay now go back to our previous diagram if I have if I have multiple environments like this if I have multiple environments Dev sit uat pilot prod do I I need to bother about versions do I need to bother about the dependencies do I need to bother about the wors do I need to bother about underlying operating system nothing a big no so our life simplified with Docker as a developer when you run when you write the code you can test that code in any environment and it devops people easily you can deploy the application into any environment with the help of Docker that is the power of the docker that is the power of the docker Docker is called as containerization software Docker is called as containerization software so what is the meaning of containerization guys what is the meaning of containerization package of application code and dependencies as one unit for executing in any system code will be available developers will write that code to execute that code some dependencies are required what dependencies are required we will specify that in the docker file okay once the docker file is available we will build that Docker file so that Docker image will be created once we build the docker file Docker image will be created once the docker image is created we can store the Docker image in the docker Hub once the image is stored in the docker Hub then you can take that Docker image and you can run that image in any ma in order to run the image you need to install the docker software that is one part we need to do once the docker software got installed you can run the image when you run the image Docker container will be created once we run the image Docker container will be created what is the meaning of a container what is the meaning of a container can I say it is one Linux box can we say it is one Linux box yes it is one Linux box now you see so many people accessed our application so my application locks are generated welcome controller welcome message execution start execution end execution start I implemented log in my application it is my springing board rest API so in this spring board rest API one get request method I have implemented for that method I have implemented logging also so the people are accessing my application so the locks are generated can you hit the URL again you can see the locks which are getting generated here now can you guys see the locks are generating the locks are coming here the locks are scrolling or not y Dynamic logs so application is running inside container container is running inside my Linux machine so in one Linux machine another Linux machine got created that is virtualization so with one image we can create any number of containers container means virtual box containers created based on the virtualization okay and here one more Small Change guys yeah stop hitting the URL stop hitting the URL so when my container is created by using this command Docker run iph p and image name can I execute any other command in this terminal can I execute any other command guys is my terminal open to execute any other command no can I run can I run one more container here can I see how many containers are running can I see how many containers are running no I'm not able to execute any other command I'm not able to execute any other command because I am blocked here I am blocked here so let's make a small change let's make a small change I want to run my container in the background guys I want to run my container in the background so what is the meaning of running the container in the background what is the meaning of running the container in the background I want to run the container in the detached mode okay so if I run the container in the detached mode my container will be executing 24 by7 and I can execute other commands also let me stop it to stop this container control C I'm going to press control C when I press control C the container got stopped good so let us see see Docker PS iph a so what is the status of my container what is the status of my container it stopped exited okay now what we can do is Docker system prun iph a delete everything is deleted okay now you can check Docker images not available Docker PS iPhone a not available it is deleted so what we need to do now we need to run the container in the detached mode how to run the container in the detached mode how to run the container in the detached mode to run the container in the detached mode same command just one option I have to add Docker run iPhone D that's it so earlier I used only Iphone P for the port mapping now I am using iPhone D what is the meaning of i d what is the meaning of i d what is the meaning of ifund d come on guys what is the meaning of i d detached mode okay execute it is not able to find the image it is downloading the image and it is going to run the image okay Docker pulled my image and it is executing my image as a container my container is created now am I open to execute other commands yes now you can check Docker images so it has pulled my Docker image it pulled my Docker image then Docker PS now you can see my container status is up my container is running and this is the port mapping my container is running and this is the quot mapping you got my point now can we access this application Aram say you can access it because it is running now you can give the name you can give any name and you can access it Charles welcome to Ashok yes I'm able to access can you hit the URL and check it now I am running my container in the detached mode guys I'm running the container in the detached mode by using iph D option Docker run i d iph p iPhone d means detached mode iph p means Port mapping and this is my image name this is my image name you got my point you got my point good so once you run the docker image in the detached mode is it printing the locks or it is not printing the locks is it printing the locks or it is not printing the locks no then how to check the locks for that we can go for Docker locks container ID it will show you the locks of the container Docker locks container ID then it is going to show you the locks of of the container if you run the container in the detached mode locks will not be displayed directly then you need to check it Docker PS will display the containers running then Docker locks you need to give the container ID with that container ID you can check the locks of your container you understood my point perfect any questions as of now any questions as of now y so the another important part we need to understand Docker file what is the docker file how to write the docker file what is Docker file and how to write the docker file okay and there are so many things that are left guys so we need to understand how to write Docker file how to write a Docker file how to build Docker image our own image how to push Docker image into dockerhub how to push Docker image into dockerhub okay then next one how to get into how to get into Docker container container is a Linux machine how can we get into Docker container okay then Docker compose is available Docker compose is available so basically I want to integrate spring boot with my SQL database by using Docker then Docker with genkins integration okay and and how to deploy Docker containers by using genkins Docker with genkins Integrations so lot of things are there that we need to discuss okay Docker with genkins integration part is also there fine so we'll plan another Workshop to discuss these things guys so today uh we thought of two hours but it went around 2 hours 40 minutes okay and uh for the spring boot dockerization the people who are asking how to write the docker file for spring boot here I have already uploaded the video how to write the docker file how to write the docker file how to create our own Docker image that video I have already given spring boot with Docker Ashok I so I have explained deploy spring boot application by using Docker so 20 minutes I have taken for this video so in this 20 minutes I explain how to write a Docker file in order to dockerize our spring boot application and I will make another video how to deploy the spring boot application with my SQL database and all that stuff so so due to time constraint now I'm stopping here so in this video I explained how to write a Docker file so this is how we are going to write a Docker file to dockerize our application so like this the docker file we are going to create once the docker file is created Docker build command will be available using Docker build command you can create the docker image so this is the command to build the docker image once the docker image is created you can run the docker image by using run command Okay so this video link also I'm going to share and I will conduct one more Workshop in the coming classes so in that we are going to discuss the remaining parts left in the docker Okay cool so all of you join in this WhatsApp group so that you will get this notes and required video and backup video on this one okay good thank you all of you thank you all of you for joining today's Workshop so I hope you enjoyed this Workshop so it's very knowledgeable almost 2 hours 30 minutes we spent for this I hope you enjoyed it thanks for your time and once again all of you welcome to Ashok I we'll catch up soon and you are part of that WhatsApp group the next Workshop date I will update in the WhatsApp group and today's class notes class video any other videos the references AWS video those things I'm going to share in our WhatsApp group the people who are watching in the YouTube yeah please join in that WhatsApp group guys so that you will not miss any update okay I have shared a WhatsApp group Link in the YouTube live chat also I will share this notes and the required videos and documents in our WhatsApp group so please join in that once again I'm sharing this WhatsApp group Link in the YouTube live chat you can join for Zoom people I have already given in the zoom chat I will update about the next class in the whatsa group so we'll work on the pending areas in that if people please like this video And subscribe to our channel for more updates give me a comment how you felt about today's workshop for documents join in the WhatsApp group I'm going to share the documents in the group thank you so much guys so thank you all of you have a great day happy weekend we'll see you soon for
Info
Channel: Ashok IT
Views: 13,850
Rating: undefined out of 5
Keywords: Docker, Containerization, DevOps, Microservices, Kubernetes, ContainerOrchestration, DockerCompose, ContainerManagement, DockerTutorial, ContainerSecurity, CI/CD, DevOpsTools, DockerSwarm, ContainerDeployment, Dockerfile, DockerNetworking, DockerRegistry, DockerVolume, DockerHub, DockerImages, DockerContainers, Dockerized, DockerEngine, DockerComposeFile, DockerizedApplication, docker tutorial for beginners, docker crash course, docker with springboot, docker containers creation, optimize docker image size
Id: 8UCm3lAdFWg
Channel Id: undefined
Length: 145min 30sec (8730 seconds)
Published: Sun Oct 29 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.