Info |
---|
Welcome back. Now let's close some of these tabs so I lose control see or hear so that the python application five thousand threes now killed I should the tab as well and I'll do the same thing on the Java tab as well I do. Except if it weren't and close this out and I'll do the same thing on the Python dissect the python instance as well so control see this de Python instance on five thousand one and do exit or here and close this out as well so the only tab I have open right now is the first tab which we started with and I will do accountancy on this as well. And right now we don't really have any of the containers that are running. Now we want to launch up all these containers from the same tab. One of the things that you would notice when we launched up the container using this Pacific Command is that your container is tied to the terminal. So you would be able to see all the logs from the application directly in the terminal. What do you want to do is we would want to launch the container up in a detached mode. We don't want to tie up the terminal along with the container. How can we do that the way we can do that is by adding an option called hyphen D. So Dr. Lin hyphen. What we are dealing in here is we would want to launch up the container in our detached mode. So this is a shortcut for hyphen hyphen detached that's placenta. You'd see that a container is launched up. You will not be able to see the logs of that specific container if you wait for a few seconds and go and run local host. All these containers we have already killed five thousand one 5000 to five thousand three. So the only thing that we have launched up right now is 5000. So this is the only one we should be running. You can see that the javascript V1 is running at 5000. So you can see that we were able to easily launch up a container in that detached mode. Now if I want to launch up the python application all that I need to do is go here and install no JS I would say by then and I would need to change the port as well. So I'll go here and say five thousand one. So we're launching up the python container on board five thousand one. Let's see what would happen if it is five thousand one when it's done here. It's a fresh. You can see that it's now working. You can similarly launch up the Java application also in a detached mode. The great thing about launching in a detached mode is that everything is happening in the background. Now all the containers are running in the background. And if you want to see the logs the command is very very simple so what we're seeing here is called the I.D. of the container. So each container is assigned an I.D. When it's launched up so we can use the idea of the container to look at the logs. So I would want to see the logs for the container. This idea. So I'll say Docker logs that specific thing and you'd see that it says the logs for it is ready on five thousand if you want to see the docker logs for the second one you can see Docker logs and see this as well. So you can see the darker logs for the python application. The interesting thing for any of the docker comment is that you don't really need to use the entire container I.D. to be able to run the commands. So whenever you would want to put a container I.D. It's sufficient if you enter a substring at this time. So some unique substring at this start should be sufficient so I can see to be it. So the first four characters of this is see to be. So if I want to look at the logs for the python application I can say Docker locks it to be here and there you go. I can see the darker logs of that specific application. Now what would you need to do if I would want to follow the logs of this specific application. I would want to keep looking at the logs of this specific application. The way you can do that is by saying Docker logs hyphen F so Docker logs hyphen F so haven F is Pollo shortcut for follow. So let's do that. So now if you can see that the terminal is tied to the logs and let's see what would happen if I actually refresh the thing. You'd see that a new log comes in just now you can see that a new log is added in and if you do again you'd see that there is another log which is added in. So what we are seeing in here is now the logs are tied to the terminal. However you can do a control C to disconnect from the logs and you see that the python application is still running. So what we have done is we have connected to the logs and disconnected from the logs. The actual container remains running in this step. We quickly launched a couple of containers in a detached mode. I would recommend you to launch up a few more containers which our container and other stuff in a detached mode and try and play around with them and I'll see you in the next step. |
Page History
Overview
Content Tools