Info |
---|
Welcome back. In this last step on the darker comments let's look at a couple more interesting comments. Doc a system and doctors that if you type in Doctor system you'd get an error. But the interesting thing about this error is it shows all the commands which you can use with Dr. system. So I would do a doctor system and say the F so the F would show the disk usage of doctor. So there are a number of different things that are present as part of our doc thing. So we have immediate containers you can store persistent data using something called volumes. You can also have something called Bill Cash when you're billing a lot of majors. You'd see that Bill Cash would be used but for now we see that there are three majors on the local and they're making use of about 337 M.B.. And we don't really have any containers running or in a stopped state right now because we did a prune on them a little earlier. So you'd see that it's zero. Now if I launch up a container let's do a docker container run high FNB White House and colon five thousand I would launch up in a detached mode and I'll say hello world Java and zero point zero point one or two years. So this is exactly the command which we used earlier. So what this would do is it would pull the image down. I'm getting an error because actually missed in 28 Min. So I would need to say in 28 Min slash Hallowell Java. So now it would actually use whatever is present in here and create a container. So we now have a container which is present to a dock system. The F. See what would happen. You can see that the container is one and you can see that images. There are three images however one of them is active. That means there is a container for it and you can see the size of all that stuff. So the organism B.F. is useful to see how much disk space your containers are. All the things related to the ochre and making use of so you can see the specific thing. And then if you want you can actually do a prune on the containers or the images or any of that stuff. Now let's do a clear and do or Docker system again. The next interesting thing is Docker system events so I'll open up a new tab. So for the events what I'll do is I'll open up a new tab and I'll do a darker system event. So when I do it all the system events you'll see nothing almost but to see the events. What you need to do is do we need to get the event. So let's try and do a docker container. Alice and do a docker container stop. B A C to using the first three letters of the idea from here and they should stop the container and then you would see events happening with docket system events. You can see what are all the commands which are being run on the container so you can see that the container is being killed and then it's given time to die down and then we are disconnecting from the network. And finally the container is being stopped and if you would want to launch up a new container you can see all the events. Also so we bunching up the same container again you can see the different events which are being launched right now so condescending noise is the new name that is being given to their specific container and you can see all the details all the events which are happening with it using the docker system. Events come in if I do. Docker system you'd see that there is one command which will not explode until it's Docker come in Docker system prune. So I loo a docker system before doing a doc assistant prune let's do a doc images. You can see that there are three images which are present but not local machine it do a docker container a less hive and a to see all the containers so we can see that there is one container which is running right now up 428 accounts and there is one container which is in exited state. So this container is stopped and this container is in a running status. So for high level Java we have two containers one in training centres and the other one is stop for no JS and python. We don't really have any major split in here or any containers present in here. So what I'll do is do a docker system prune and pass in argument of hyphen. So you would want to delete all the containers all the stopper containers and we would want to delete all the images which don't have a container associated with them. So it's dark a system prune hyphen. A This is something which is very useful whenever you'd want to do most things which are unused in your system. So if you're running out of space in your system and you'd want to remove all the docker images. This is a very useful comment. So what it's saying is it will remove all these top containers and it will be more all the images without at least one container associated to them. So no JS and Python can images do not have any containers associated with them so they'll be removed. It will also remove networks and also the build cache will look at networks and build cache a little later when we build a image on our local machine. And also when we actually try and get a couple of micro services to talk to each other for now let's say yes and plus enter you can see that there are a few containers which are deleted and also it is deleting a few images as well. So let's do a clear and say darker images. You can see that there is only one image present and docker container a less hyphen a. You'd see that there is just the running thing which is left off. So the docking system prune hyphenate command can be used to remove all the unused things that are laying on your Docker system. Now the other interesting commands are Docker top and up stats. Let's do a docker container Alice and let's see the next command which is to look at the stat so you can do a docker stat and passing a container. Whoops I just did a docker stats and actually that is just one container running right now. So it took it by default. But ideally you'd want to be able to do Docker stat and pass in a container. And they should show all the stats about that to basically container. This would show how much TB is being used how much memory is being used and all that fun stuff. What I lose I'll do a docker container stop and for two is the first two digits of this container lady. So let's stop this and what I would want to do is I would want to start that container up with a little less amount of sleep. I would want to forget how much sleep you and how much memory that particular container can use. How can I do that. Let's go back to the container one command. This is how we launched up the container and Oh here you can add in another option. So all here I can say hyphen M and C use fight to make off memory. Same thing. Use Only if I dual megabytes of memory and plus enter and I can do a docker stats and pick up this idea and let's see what it says. You can see that the limit now is not too shabby anymore. It's just 512 megabytes of memory. You can also see that at some point it uses a lot of you. So when the application is starting up for the first time it does make use of a little bit of the bill. But if there are no request subsequent to that it does not use a lot of all. So you can also control how much sleep you you'd want to give to the application as well. So let's do a docker container less and let us do docker container stop and do 7 1. That's the I.D. which I picked up from here and over here I can do a docker container one and I can see how much seepage you would want to give to this. So let's say I would want to assign 50 percent of the CPI. So this specific container can use 50 percent of the CPI. How can I do that the way I can do that is by using a flag called CPI quote. So I'm saying happen. See you quarter here we are giving the fully expanded option and that's the reason why we are using hyphen hyphen so hyphen event CPO quota and how much sleep you go to do we want to give it I want to give it a sip you quota of half so the total tip you quota is a hundred thousand and out of which I would want to give half. So it's fifty thousand. So this is something interesting. The total CPO quota is a hundred thousand and from it we are getting 50 percent of the CPI. Fifty thousand. So this would launch up the container. So let's do a container stats for this and let's see what would reinstate it. So you can see that this heap utilization remains high for a little while because only the half zip use available so at the start up time it only has half the CPI so it will take a little more time to start up. So now the application is started up and the CPI utilization goes down drastically in step. We looked at a number of things related to dock system. We looked at Dockers and beef which is to show the disk usage of Docker. We looked at Docker system events to see or leave it behind a container we looked at Docker system info to get a lot of information about Docker what is the client what is a well what are the options where are they running in how much memory is present and all that stuff. And we looked at Docker system prune to remove all the unused data which is present on your system related to Docker. The other things that we looked at were the comments related to that. So we ran a docker stats command to see how much CPO how much memory the application is making used off. And also we looked at a command to assign a specific memory and CPI quarter for a specific container. I'm sure you are having a lot of fun and you are learning a lot of comments. I would recommend you to play with these commands again and again. Because when you are working on a project with Docker you will use these commands a lot of times to get comfortable with all these commands and I'll see you on the next step where we will start building our images until then but. |
Page History
Overview
Content Tools