 Hey there welcome to this course on Docker. My name is Sprangel and I will be your course instructor for this class. In this course, you will going to learn all the fundamental concepts of Docker and why you should learn this container based technologies. Starting with installing of Docker and QNATs, we're going to create a Python based web application with database into it. Once we have our application, we're going to set up the version control system with the help of Git and GitHub. After it, we're going to create the Docker file through which we're going to control our application into Docker image format, so that we can easily ship it anywhere we want to and run them very easily. That's why the Docker base applications are popular these days. Once our Docker image is ready, we're going to publish it into the Docker hub from where anywhere you can access your Docker image and anyone can pull it and run them. Moreover, Docker is platform independent. So there will be no problem to run your application as well. They are light in weight. So the computation load will be also low. Further, we'll going to create the Docker compose file from where you can easily define and run multiple container Docker application. So if you're very curious to learn all about Docker, start learning right now. See in the class. Hi, welcome back friend. Now you already familiar with what is Docker and before heading to first the actual deployment or Docker images and all other concepts, let us first discuss the various stats that clearly signifies the increasing demand for Docker among professionals and why you should learn Docker. As you can see here, Docker is motion wanted technology in the IT sector and professionals are showing a high interest in Docker over time. The stats are taken from stago flow survey, which is actually kind of annual developer survey where developers shows their interest, whatever technology they are using or whatever they want to be in future. And here the next step here, Docker is chosen as the second most loved platform on internet. And you can see here that Docker is gaining the popularity and the love over time. And it is about the Kubernetes AWS event Mac OS, which simply signifies the growing demand for this Docker technology. Now, here I'm going to present some more graphs and figure which is taken from Docker.com over three years. And here in all the figures, I found something interesting which is that there is always a upward trend is there, whether we're talking about total number of pools in the Docker hub, order to installation or Docker desktop, or whether I'm talking about number of users and the repositories in Docker hub, all are increasing over time. This simply signifies the demand of Docker. And companies are adopting this technology, the Docker technology, and looking after the Docker professionals. This simply means that Docker is a hot topic in the IT sector. And if you have a scale on Docker, then it will be very helpful for your career path, either you are building a new carrier or want to do switch between the companies. Docker is very crucial technology and it will help you a lot. This is the timeline or technology, the evolution of technologies where it started from 1950, the first commercial computer. And then there is made from computer in 1960s, then there is desktop computer in 1970. There is a difference between the 10 to 20 years between them. But after internet mass adoption, after 2000, the technologies evolution, the period between them, the gap between them is decreased. Like on 2003 AWS launched then over two years Intel virtual technology has released the AMD, then KVM, LXC and Hyper-V. These are virtual virtualization technologies were introduced in the technology world. And virtual machine has a great advantage like it gives isolated environment with the high security. But but but when we compare it with Docker like container technology, they are somehow lagging behind the like, Docker's are lightweight, they can boot fast, as well as they are portable and can easily scale. And in upcoming years, the darker will be at the peak, the demand is increasing. And after Docker 2015, Kubernetes released and then to 2016, Windows container released. So the time between them is also reduced. And this is a huge shift from the 1950s to 2016. The world is changing and they're adopting a new technologies and darker like container technologies are the new one. And it going to be evolved over the time. And the best thing is that till now, Docker is eight year old, even it is not have experience of one decade as well. And it is growing massively. So it will going to be rise. And if you have a skill on this Docker, it will be very, very helpful. Okay, now let us compare with Docker with other containers technology, like there is container D, Windows container, RKT and part man, among them Windows container and part man are having some weightage over container D and RKT. But when you compare this Docker with other alternatives, you will find that there are negligible if you're going to compare with Docker. Docker has a huge popularity. And everyone using this Docker and I've shown the stats that there is a massive activity in the Docker Hub as well. So now I think that now you don't have a confusion like why should I learn Docker? I will recommend that you having a skill on Docker, will be very, very helpful for you. All the best for the future and see you in the class. Hey there, and welcome back. In this lesson, we're going to learn that how this Docker one command work, just like printing Hello World program in any of the program language, we're going to use this Hello World image. So what happened when we written on this command, it looked for that particular image in our local registry. But when it doesn't get there, it just pulled that particular image from the Docker Hub and executed the container for it. So what happened? This is a Docker client, where we rated down some kind of commands there, then it used with the help of APIs, it communicates with the Docker server, or you can say Docker daemon, then Docker daemon started all the process, all the container related process, like pulling up the Docker image, then creating the container from that particular image, and so on things. Now I'm going to create another container. And you can say it as a interactive batch session. Okay, so what are we going to do here? It again search for their Ubuntu image, but it didn't get there. So it pulled that image from the Docker Hub. And as I said, that it is an interactive batch session. So we are inside that Ubuntu container. And once we are going to exit from this interactive session, then this container will automatically will be exited. And this is how this interactive session works. Okay, now let me run some of the basic commands. And this is the whole structure, the file structure of Ubuntu container. Now let us use some of the commands. And here I'm going to list the images which are right there in my local registry. So check it out, you can use this Docker images command. And here you will get the list of all the images which are there in our local registry. Now to check the containers which are there, just write down Docker container space Alice. Okay, remove this. Yep. And here you can see that only one container is running right now that hello world one is is exited after performing the task. Now this Ubuntu will be going to be exited. Once we are going to exit from this interactive session, let me show you out. I have to exit from this interactive session. Let me open those next terminal, and then check it out. Now you can see the containers, both the container having the same status, they are exited with the status zero. So this is how the whole scenario look like. Okay, and we're going to learn more about Docker related commands. Let me show you that how many commands are there in the Docker, let's you need to write this Docker in your terminal, and you will get the bunches of the commands options, commands like build, compose, config, these are very, very useful commands and are all related to the management commands. And the command section where we have attach build, create and managing the containers debugging the containers, processor to commands, and many, many other commands are there, we're going to learn each of them. Now, let us focus on that how you can log in into your registry. So for it, you need to use the Docker login command. But before it, I must log out from this session as I have already logged into it. Now let me show you that how this process look like this unit right Docker space login, then if we'll ask for the username, write down your Docker hub username and the password, which is will be not visible. Okay. Now it will going to save all your credentials into your config file, and the location is also there. So this is how you can easily logging into your registry using the command line. So hope you are interested in this upcoming lessons. See you in the next class. Hi, I'm welcome back friend in this lesson, I will show you that how you can start interactive batch session using Docker on command. So simply write down Docker run, and then you need to provide the name of your container name, which is open to bash here, then write half an it which is used together in order to allocate TTY for your container processes, then you need to provide the name of your Docker image, which is open to latest here, and at last bash. Voila, we are now inside this open to container. Let us check that our container is running and not the current status of our container. Just simply write down Docker container space LS LS simply means list, okay, and here we find that our container is running right now. And it will work till that we exit from that interactive session. Okay, now I think it is the best time to execute this Docker exec command, which is used to run a command inside the running container. And here I'm going to create a simple test file for it, you need to provide the name of your container. And you need to write down the command which you want to run inside that container. And here, we tried to create a test file. Now let us check that the command which we run from the outside container it for final not here you can see the test file is created from outside. This is how this Docker is a command work. Welcome back friend. In this lesson, we will discuss about two important commands, one of them is Docker version command, which is used to render all version related information in easy to read layout. As you know, that Docker architecture supports client server model. So we have two section one for client and other for server. And in each section, whatever components they have, we have the information of version of all of the components, like API version, go version, Git version, and so on things. And another important command is Docker info command, which is used to gather a wide range of informations related to client and server. In client section, you will get the context which is default here. And you can manage Docker soft cluster Kubernetes cluster using that context. Then we have some plugins there in server section. You can get the information related to containers images and those server versions. And what kind of storage driver you are using the secret travels and the plugins which are there inside the server and the information related to swarm that the node is active or not and how many nodes and managers are there. Then what kind of algorithm is we are using which is graphed here. And what kind of runtime is you we are using the version of that runtime, and the kernel versions and what are the operating system which we are using the operating system type which is Linux here, the architecture, the number of CPUs and the total memories, then lots of lot information you will get inside this Docker info command. So if you want to know that how your Docker ecosystem look like, and want to gather some of the importance and the crucial information about your Docker, you can simply use this Docker info command to get all of them. Hey, friend, welcome back. Here in this lesson, we're going to create a simple Python web application using flask. And here I'm using Python IDE. And I will suggest using this ID because it makes your work much easier. And you will get a bunch of options within the same window. Now you are inside this virtual environment. And now I'm going to check it out that any kind of libraries and packages are installed into this virtual environment. And you will get nothing. So this is how I have isolated my project with other project using this virtual environment here. Okay, now I'm going to install this flask library, which has required for now, and we're going to add some more libraries later on. Okay, now you will find like there are a list of libraries and packages are there which are much related to flask. And now, first and foremost, we need to import flask package, just write down from flask import flask. Now let's create an application instance for our flask app. And here I'm going to give it an app name here. I'm going to pass some spatial variable of Python, which is the name here. Okay, now we need to add some decorator into it. This decorator thing is very useful as it will going to convert your simple Python function into flask view function, which means like, whatever the value it will go into return from this hello world function, it will become the HTTP response. So whenever we are going to hit this URL, our base URL of the web application, if we're going to simply retrieve this string, which I'm going to pass here inside this hello world function, keep learning and keep moving ahead. It's not a simple string. It's a slogan which I generally use and apply into my daily life. Okay, now we're going to run this application for it, you need to mention app dot run. And inside, you need to pass the things like ports, host name, or any other thing like debug. Okay, so here I'm just going to put this debug equal to true. So whenever I'm going to run this application, we will get whatever things going behind the scene. Okay, now I'm going to add ports as well. And you can give any port number. Okay, and here I'm using simply 5000 one. Okay, now our code is completed. Now let's run this application here. Okay, now we have run our application and you can see that our string, which we've passed through this hello world is displaying here in our web page, just because of HTTP response. Okay, now this is my local host. And with the port number, which is 5000 one, which we passed using this app dot run. Okay, now I'm going to stop this application. And so this is how you can create a simple Python web application using flask. Hey, friend, welcome back. Here in this lesson, we're going to cover what Docker file look like and how you can write your own Docker file. In my previous lesson, we went through the process of deploying simple Python web application. Now in this part, we're going to simply look after this Docker file. For it, we require the base image. And here base image is Python. This is the official Docker web site. And here you will get bunches of different kinds of tags there, which you can use. Okay, I'm going to use this mid one. Okay, 3.9.5 buster. Okay, now let's create the Docker file. Docker file is simply build instructions to build the Docker image. Okay, now the first part is from command, which tells us what kind of image to base this off. And it is a multi layer approach which makes Docker so efficient and powerful. In this instance, we're going to use this Python Docker image, which again, reference the another Docker file to automate the build process. Okay, now let me mention that what this we're going to do here in the comment section. Now the other most important part is to add our project file into it. Okay, for it, we're going to use the add command here. Okay, so let me write down the comment section here. Import code. Okay, so whatever I'm writing inside this comment, it will be very useful when you're going to download this Docker file. Okay, now simply write add space dot, which means your current directory and slash and your code. Okay, so it will not going to create a code directory inside your Docker container, okay, your Docker image. Okay, now I'm going to change my directory and go inside this code directory. And now we require to install all kind of libraries and packages so that we are able to run our applications. Okay, as we know, this Docker makes your deployment much easier, and you can run it anywhere. So we are creating the Docker image through which a container will going to run. So whatever your app which is inside your Docker image, whatever the packages and libraries which were required for that application, you need to put down there. Okay, now I'm going to simply expose the port which is here, which is 5001. And now I'm going to simply run our main Python function, the main Python driver file, which is that main dot pi. And here I'm going to simply use this cmd, which is stands for come on. And if we're going to run this Python main dot pi. So this is my Docker file look like. And now I'm going to build our first Docker image, make sure that Docker diamond is running. If it is not running, then it will not able to pull this base image, and we will get some kind of error there. Okay, now the command which I'm going to use here is Docker build command. And here I'm going to put down hyphen t, which simply means tag or through which you are just naming your Docker image. And we're going to call it as a flash tab here. And the path where your Docker file is, which is the kind actually simply put down that dot. Now it started all the process, which is here to extract the base image from the Docker Hub official website into our local registry. Okay, so whenever we're going to use this Python base image, we're not required to again, pull this up from the Docker Hub. Okay, now our Docker image is ready. Let me check it out using this Docker image command. And here you will get the list that how many Docker images are there inside your system. It's always a good practice to use git and GitHub as a developer. And it is very helpful when you're working with a team, and they are located at different locations so that you can share your code, and then build your application. And also get a GitHub very useful to maintain the version of the project as well. Now here I'm going to create a simple GitHub repository. And here there's nothing. So now I'm going to copy this URL and open my git bash here. I've already logged into it. So there's no need to log into this terminal. Not to any slides, your empty git repository just use this git init command. Now to check the current status just use this git status command, you will get all the files inside your current directory are all untracked. Now, here, there are some of the files and directories which I don't want to push into the GitHub repository. So I'm going to create the dot git ignore file. This is a file where you can keep all the files and directories details, which you don't want to push it to the GitHub. Okay, so here this one directory that I don't want to push into my GitHub. And I'm going to copy it here. And yes, it's very easy to do so. Now, let's check it out that for the current status and you will find that dot idea directory which were showing earlier is not there. Okay. And now I'm going to make all the files to track one, you need to use this git add command. Okay, let's write down git space add space dot which simply means all the files in that current directory will going to be added. Now you will find that all the files are not tracked one. And now it's time to commit them so that our local repository will let it know that what are the files and what are the codes which are inside that files and maintain the version. And here we successfully maintain the first version of our project. Now, it's time to push our code into the GitHub. And I've already shown you that the remote URL of our GitHub repository. Okay, now I'm going to use the git remote command to add that remote repository URL. Okay, so let me check it out that any other remote URLs attached to this or not, as you can find there's nothing. So here you can clearly copy this. And just write git remote add origin and that URL which you have copied from there. So now after it, it will going to add this remote URL. Now you can use it for fetch or you can use it for push. Now, the last step is to push into the GitHub repository, just write down git push origin master. As you can find here that it is set to the master branch. So I sent it written down the master branch. So all the files will going to be added into this master branch. But what happened here that the GitHub repository when I've created, it already have a branch name with main. So we don't require this main branch right now. So it's better to delete this branch. Let me show you that how you can delete one. So in the setting option, you will get the option to change your default branch to the master branch. And then at last, we're going to delete this main branch. And yes, all the files, all the projected source codes are pushed to this GitHub repository. So you can free to use this code anywhere where you want. And it will very helpful to practice it. Okay. All right, now we have learned how to build Docker image using Docker file. Now, let us execute this Docker image to create our first Docker container, where our application will going to be run. And don't worry about the size of this image. This is an issue and the Docker team is working on it. And we are using Python Buster image, its size is too much is a proxy 20 MB. So leave this apart. Now, let us dive into this Docker image. And here you can find the complete history of our Docker image. All the things happen with this image are described here. I think you have noticed or not, but you can see here that the all the process which are happened with this Docker image is it is in the reverse order. Okay. And you can see that that at the top, you will find the command which we written down at the last line of the Docker file. So this is all the steps all the process which happened with this Docker image. Now, let us execute this Docker run command to create the Docker container. Just simply write Docker run hyphen it and hyphen p p parameter just to map your host port 5001 to the container port of 5001. Okay. And you need to provide the name of your Docker image which is flask app here. Just copy it down and hit the enter button. So now our application is running inside the Docker container. Let's check it out using this URL. And you find that this space is not working right now. And you know that what happened here. Let me explain to you that problem which we face here that firstly we built a local host interface but we should bind it with the zero dot zero dot zero dot zero host so that we can access our container from outside for just because of different Linux kernel, Docker container kernel and our PC container are totally different. That's why we are unable to use that same local host interface to access the Docker container application. So it's not going to work if you're going to think that same local host will work here but not so here to interact with that in container, you need to use the bridge communication the bridge network here. And if you're going to log in into directly into this Docker container, you will find it just you need to execute this IP address command to get the complete information related to your IP networks of that container. Now I've already checked it out before. So now I simply written on this zero dot zero dot zero dot host name either you can write that broadcast IP there but it's okay to use this one. Okay, so our application is now running. Now I'm going to run this command again. And you can see here there's new IPs here that IP which I'm talking about. And it will not going to open our application which is running inside that Docker container. So is it cool? Is it so we have executed the Docker container and also check that our application inside the Docker container is running or not, and it works fine. So in the later part of series, we will be going to dive into more in this Docker thing. Hi, and welcome back friend. Now in this lesson, we are going to push our Docker images into Docker hub. So let me build the image again, as I have deleted that image. So to build your image is to simply execute this command Docker build hyphen t and the name of your image and the location where your Docker file is. So it will take hardly one minute to create image. Okay, now we have a Docker image. Let me show you and it is Flask app here. And now you need to log in into the Docker hub using this Docker login command as all the credentials were saved. So it login it easily. Now you need to push your image to the Docker hub. So here I'm going to use this Docker push command. But before it we need to create a public repository in the Docker hub. Docker hub is a repository cloud based repository which stores different kinds of images just like a GitHub GitHub stores source code. And in this case, we can download or publish our container image there. And you can have the plugins as well. These are some Docker related repositories. Okay. And I'm going to create a new repository here. I have already published some of them. Now to create a repository, you need to provide a name. And there are two options there. One is public repository or private repository. I will choose this public repository so that it can be accessible by anyone. Whereas the private repository can be accessible by concern team or to whom you want to share. Okay, our public repository on Docker hub is created. Now I'm going to use this PSR with three slash Flask app. This PSR with three is my Docker hub username. So the first thing which I need to do here is to tag my local image using this Docker tag command, just use the name of your image which is Flask app. And with the name of this srv slash Flask app. Okay, now let's paste it here. And now we have successfully tagged our local Docker image with that image. Okay, now I'm going to push that image to the Docker hub. And it will take hardly two to three minutes. Let me fast up the process. And this will be able to push up our Docker image to the Docker hub. Now let me refresh this page. Then you will find that in the tags and the scan section, the latest tag is there. And we just pulled our image within a few seconds ago. Okay, now I'm going to show you some of the things like how you can pull this Docker hub image and how to make use of it. Okay. Now this is the public view of my Docker repository. I'm going to use this Docker run hyphen it hyphen b five thousand one not five thousand one, the ports. And you need to give the name of that image, which is psrv three slash Flask app. Okay, now just paste it here and run it. So it all things started. Let me show you the container section and open in the browser. So it worked fine. Okay, now I'm going to delete all the images. You may think that I've already have the image that this thing saved on local. So it's better to delete that one. And again, run this come on. Okay, these are the logs of this running container. Yeah, remove that container right now. And now I'm going to delete all the images which are there. There's both images. So you need to use this item I come on. And you need to provide both the name of your images. And just delete it as well as untagged. Okay, now we don't have any kind of images in our system. So now it's time to run that command Docker run one. You can see there's nothing is there. But I have logged into my Docker desktop. And here you can see that in the remote repository tab, my Flask app is there. Okay, either you can pull the image from there, or you can simply use this Docker pull command to pull that image. Now let me show you some more things. And here you can see that it is back to this our online repository. Here you can find the images layer. There are multiple images and each layer have their role like installing something then adding the files and so on things. Okay, now I'm going to use that Docker pull command to pull this image. Okay, this command and open your command prompt. And just see there is no images there right now. Need to use this Docker pull command. And if we're going to download everything and it pulled the thing. Okay, now I'm going to run this Docker run, then again, hyphen it be for the ports. And this PSI with three Flask app, and it will going to run this container again. It's taken from this Docker dot IO, which simply means that it pulled the images from the Docker hub. Okay, so don't be confused. Now we have pulled images from Docker hub, and it is now running on our local system. So this application is working fine, it means whatever image we created using Docker file and it is now posted to the Docker hub is working fine. Now you can share the link of this repository so that anybody can use this application. Hey friend, welcome back. In this lesson, I'm going to discuss commands which are related for debugging purpose, like inspect command, logs command, stats command, the top command. And the best thing is you can get it all inside that Docker desktop. But again, I want to say that this is the command which you must know. Okay. Now the first one, which I'm going to show you is Docker container inspect command. And here one container is running. So I'm going to use that only container ID, and you will get a bunch of informations here, related to this container, that what kind of image which we are using here, what is the networking, really settings here, and various other options you will get here. Let me convert this file, the output of this inspect one into the text file. So that we can easy to open this all things here. And let me add it into this dot ignore file, because I don't want to push into my GitHub repository. Now here you will find that it shows the Docker ID at what time is created the path, the argument and the command which is running right now Python main dot pi. And it also says the state that it is running or how many times it is restarted and so on things. And here it gives the information related to image, the host path log path, and the platform which is Linux here, and the different kinds of labels you can find here, I have not use the labels, but labels are very useful. So there you can attach labels with other container and operate all of them with this single command. And this detective y is true, which means you do interactive command cell. And here you can find the environment details, the command here, which is Python main dot py. And the image which is flask app here, we didn't add the volume here, but we're going to add it on later section. So you will get the various information in this inspect command. This is our commodity to do settings. Okay. And it's the host type is zero, not zero, not zero, zero, so which we use here. So now I'm going to show you the logs of this container, just write down Docker container logs and that container ID, and you will get the logs which is this. And let me show you inside that Docker desktop, the same log you will be able to see it again. And it is. So this is a log which is there in my Docker container, it means that our application is running right now, which is active at that URL. Okay, now let me check that the stats of my Docker container, it will give the percentage values of CPU, your memory uses your disk read write operations, the network related input output. So you will get the information's a real time information of your container. Okay, so 1.16, which is the percentage of CPU we got there. And now at last, I'm going to use this top command that what are the processes which are running in my container. So just simply write Docker container top and the ID, you will find that there are three UIDs there, that means there are three processes are running. And they're mostly run that my Python main dot py. Okay, and through which the all the CPU legislation is taking up just because of this process. So this is how you can check what is running inside your container and what is the status of your container. Till now, we have learned how to build simple Python class application. And then we have created the Docker file through which we have built our Docker image. And also we have created the container from that Docker image. And at last lesson, we have pushed all our project files into the GitHub repository. So so far, we have did a lot of things now it's time to make our hand dirty on some of the basic and the main commands which you must know while using this Docker. So let's get started. The very first command which I'm going to use here is Docker container LS through which you will be able to see all the containers which are running right now. And as you can see, they are two containers are running. Now I'm going to restore one of the container using this restart command, the simple write down Docker container space restored and the container ID. So if you're going to restart one of your container through your command prompt, okay, either you can use those that Docker desktop application, but you must know how to deal with using the command line as well. The process was too much fast that we are unable to see that our container was restarting. But one thing you can find here, the masses which were showing earlier the logs, they are in twice, they were twice just simply means that our container were restarted. That's why there is two log file there. Okay, and you can find here also this Docker container LS the status is showing in the seconds, which means the restart the application has been restarted. Okay, now I'm going to use another command to pause my container. And let me check it out in my Docker desktop, you'll find that the container is now paused. Now to make this container unpause, the command is simply unpause. So it will go into unpause your container, it will turn your container to run it again. Okay, so these are basic commands, which you must know, one is a list, other one is restart, then pause, then unpause. And another command, which I think which you must know is remove, okay, and it says that container was running, so unable to remove this. So I'm going to use this force method, the sudo method, and it will going to remove the container. Okay, so these are some of the basic commands, which I have discussed in this lesson, we're going to learn some more basic commands in the later on series. Hey, friend, welcome back. In my previous lesson, I have shown you that how you can restart, pause and pause and even remove your container using command line commands of Docker. Now, in this part, we're going to discuss some more basic and advanced commands here. And it is very important to know all the commands of this Docker CLI commands, so that once you are eligible to give this DC exam Docker certified exam, at that time, you will require this commands. Okay, the Docker image is used to show all the images which are there inside your PC. Now Docker container, it have a loss of commands there. And in my previous lesson, I have also shown you that how you can list your container using this Docker container LS. This command will give you information of container like container ID image which is running there. And at what time it's created the command is running right now the status, the ports, and the stupid fire send instance, which is the name of this container. Okay. And there's a cool story behind the name of the container which Docker gives. And I will be discuss on the later on series. Okay. And now the command which I'm going to discuss here is create command start command, you know, to run your Docker image, we can simply use Docker run command. But in case you want to create the container, and then you want to start your container later on for it, you need to use this create command, then later on start command. This is the you can say it's a creation like Docker run is equivalent to Docker create plus Docker start. Okay, so I'm going to first create a Docker container here, let me show you how it works. So the image which I'm going to use is Flask app here, it created the container. And now I'm going to start this container. And this you need to use as you can find here that it's not showing here because it's not running right now, but it is there. So you can see here the status is created, not it is running there. Okay, now in the containers tab, you will get the container which we created now. Now I'm going to use this Docker container start command to start this container. I think you got the point, like, which is Docker run is equivalent to Docker create, plus Docker start command. Okay, now I'm going to put this container ID here to make this container started. And if you want to restart pause and pause, I've already discussed in my previous lesson as well. Now, we have started this container. Let me check it out inside this. Okay, first I'm going to write the command. And here we will get that this container is now running. Okay, we don't need to use this hyphen a command, which simply means all the containers. Okay, now you will find this reverend one container is running. At last, the only thing I want to say here, keep learning and keep moving ahead. Alright, in this lesson, we're going to discuss about Docker export command, which is very useful so that you can get all the contents of your container in the form of the zip format. Okay, so here you need to use a simple command, Docker container export and the container code ID. And you need to use this hyphen O parameter, which is stands for output and give any name for your zip file. Here I'm just going to give a name container dot dot, okay, is a form of some phrase format. Okay, so now it will go into export all of the things which up there in my container into the form of zip format. Okay, and now you will get this zip file here. Now I'm going to extract all the contents here. Here, our code is there, where you will get that our main application file, and the Docker file there. So this is how our container looks like. Okay, so if you want to check that all the contents which are here, you can even check it by running the shell commands into the container and list all the directories there. So here you will get that libraries and all the things they are Docker file main dot by your virtual environment is also there. So this is how your export command work. And it is very helpful at the time of when you want to backup something which are there in the container. And the thing you need to note here that this Docker export command doesn't export the content of the volumes, which are associated with the container. If a volume is mounted on the your existing directory, then we're going to export all the contents which are there. Okay, not the contents of the volume. So don't be confused. I hope now you have understand the difference between Docker file and Docker compose file. Docker file is a simple text file that contains the commands so that it will going to build the Docker image where Docker compose file is used to define and run the multiple containers of your Docker application. So here in this lesson, we're going to create our very first Docker compose YAML file as we have only one image here. So we're going to create the Docker compose file for only one container. But later on series, we're going to add some more containers into it so that it will create the multi container application. And here I'm using the version one and services represents containers and here with the container which I named here is app here. And then you need to provide the location where your Docker file exists. And then here, I'm going to use this port which is used to map your external host to the internal host of the container. And here the port ID which I'm using here is 5001. Simply write 5001 colon 5001. Okay, the next thing is volume, which is very important component of this and Docker compose file so that it can to represent the pattern directory of your host to the core directory of the container. Let me show you out. This is the container. And inside it, I have created that core directory. Okay, so I'm going to mention here. Okay, so now our Docker compose YAML file is ready. Now let's build Docker image using this Docker compose YAML file. So you need to write down this Docker hyphen compose space, then build. So it will going to start all the process to build the Docker image like it will going to push that base Python image, then it will going to install all the libraries and dependencies, and so on the process till now we have only two Docker image one is flask app which we created using the Docker file. And we have Python based image through which we have created the Docker image. Now the process is somehow completed and it is completed. And the new Docker image is now ready. Now let's start this Docker compose and to start this Docker compose, you need to simply write down this Docker hyphen compose and space up. Then if we're going to start all of your applications, I mean, all of the containers which need to be deployed, as you can see this new Docker image app underscore app is created. Now let us execute this command Docker compose up. So it will going to take that newly created Docker image to create and run our flask application. And here you will get the URL. Let us open this URL. Let me check it out inside this Docker desktop. of the container is running around. And here you can see there that our flask application is working fine. This is how you can use Docker compose to create a single container application. But later on, we're going to add some more containers into it. Now I'm going to execute that Docker container LS command to get more details about this running container. And here you will get that at what time it's created and whatever name it is given to it. I'm not going to change this app app one name of this container. And to change the name of the container, you need to use this rename command Docker container rename and your old container name with the new container name. Okay, so now I'm going to push this Docker compose a file to our GitHub repository. At the time when we are building up our Docker image using Docker compose. So two to three, some randoms directories and files will created, which are not required to be pushed to the GitHub repository. So I'm going to add it into the get dot get no file that bin on directory and the build directory. So whatever directory which is created after this Docker image creation, we're going to add into the dot ignore file so that it cannot be added to our GitHub repository. So I've added this Docker compose a file. And now I'm going to commit it with the masses that I've added this Docker compose file. Now I'm going to push it to the GitHub repository. So just write down Docker push origin master to push your files into the GitHub repository. Okay, so you need to use here the get push origin master. And let me clear my output screen here. And instead of Docker, as we have repeatedly used that command. So mistakenly, I've used in this Docker command here, the simple write down this get space push space origin space master to push your newly added file into the GitHub repository. Now, refresh this page and you can get your Docker compose file there. So this is how this Docker compose file work. And later on the series, we're going to add some more things into our Docker compose file. All right, now we have Docker compose the file. And we know that dark compose young files basically used for multiple containers till now we have only one container. Now we're going to add some more functionalities into our application so that we can add few more containers into our dark compose the file. So here I'm going to add this red is which is stands for remote dictionary server, which is very fast. And it is best thing is it is open source. And it has the capability for in memory key value data storage, which is basically used for the cache, the masses broker, the queue, as well as for the database. And here I'm going to define this ready instance for it you need to provide the host name which is local host here and the port, which is 6379. Okay, this is the default which this read is used. And as this is a part of radius client, and you need to have your ready server as well as so I'm going to show you how this study server work. But before it, let me add some more things into this main dot Python file. And here inside this our main function, the hello world function, I'm going to create a variable name hit and so whenever the page is visited, then it will going to increase the value of hit. Okay, so I'm going to use this radius as a cache memory so that whenever we're going to hit our this URL, our flash application, then the number of the page view will going to be increased. Okay, so here, I have mentioned the hit so you need to pass this percentage space radius dot get and the variable name which is hit here. Okay, now, let's run this file and check it out how it works. Okay, so it is yes, this is very important to have this new format option. Now I'm going to run this main and it is ready. Now let's open this URL and we got some error here. Okay, okay, yes, we got this error because we have used this host parameter because at the time of building darker image, we have changed that thing. Now to run locally, we do not require this host here, just remove this. And I'm going to restart my flash server again to check it out that it's working fine or not. Now, we have got some kind of error here, radius dot exceptions dot connection error, error one 0061, which simply means that no connection could be made between the target machine as it is refusing it. And the thing is we didn't started that ready server. So you need to start this ready server. And now we can create the request from our client application, which is our plus application. Okay, now I've restarted the server again. And we got the message, keep learning and keep moving ahead. But still, we didn't got that count. But we have one client is showing inside that ready server. I think there's some kind of mistake, a silly mistake can be here in this class application. Okay, inside this return part, we didn't added the data for format specifier. So we need to provide the format specifier here so that we'll get the number here. Okay, now restart your class application again. And yes, you will get the count which is two here at the beginning. Now whenever we're going to refresh our web page, the current will be going to increase. This is how this radius work here. Hey, friend, welcome back. In the previous lesson, I have shown you that how you can add radius cache into your flask application. So whenever we're going to refresh our web application, then it will going to increase the page count. Okay, let me show you again that how our application work. So this is my web application. And whenever I'm going to refresh it, you can see the page count is increasing. And I restarted the server. That's why the count started from zero. Now, this is our Docker compose the animal file. And here I'm going to add this radius. And this, my application is totally dependent upon this radius because the page count, the database which we require here. So I'm this need to add this radius here. And the image I'm going to use is studies as well. So here I'm going to change some of the changes here. Like, now we are going to install all our libraries and our dependencies with the help of requirement or txt file. And we have added the radius here. Now we're going to be free and directed to this record or txt file. So it will going to create our requirement or txt file. And it will contains all the list of libraries and the packages with their version. Now here you can find that radius is not there. So either you can add radius simple here, or you can even use this command pip install radius. And again, you need to use that command so that radius is added into our requirement or txt file with the version detail. So now our requirement or txt file is also ready. And now let me check it out that all the things are well. So here you need to add that some of them changes here. Because we don't require the local for sure we require the radius server here. And yes, we need to use this host 0.0.0.0. So all the things are now changed. And I don't think so that any kind of changes are required here. Let us use this Docker compose build command to build a new image. Sorry, to update that image. That's a particular thing. And it will going to build that new update new image. And let us use this Docker compose up command so that we can check that the image which it is updated is working fine or not. And all the things are started right now. And our application is now running, you can find it here. So whenever you're going to refresh the page, it will going to increase number of count. And now we have two containers, one is our main flask application and other one is ready server. And here you can find all the things related to the logs related to your main flask application. Okay, so now there is two options, two containers are there. So you can get the two logs for each of the containers, like for readies, you can find here that the counts, okay, there you can see that whatever we requested from there, it added there, even in this debugger mode, also you will get all the things. Now I'm going to stop all of the containers. And now I'm going to push all the things which we made here into our GitHub repository, so that you can get all the codes and the things so that it will be very easy for you to run and create our containers there. So there are three files which we have edited one is darker file one is darker compose YAML file, and we have main dot pure file, and one untracked file is there which is record record or the extra file. So I'm added that file here. And I'm going to commit with the message that we have added ready discussion into our flask application. Okay, we have committed all the things. Now we need to push all the codes into our GitHub repository, simply use this command, get push origin master. And all the things are done. Okay, let me check out my GitHub repository here and refresh this page. And you can find that darker dot compose YAML file is there and record or text file is there. And we have the common message which we have added. So hope you understand how you can work with multiple containers using darker compose. Okay, till then, keep learning and keep moving ahead.