We have just successfully agreed that the small Express Web seller application is using Lord Jesus and
we have executed this application.
And before that we have installed some additional packages namely express package along with is dependencies
using npm install command and all of that we have are from inside of the node GSA container.
There was no beam or node running on our local computer but now there was a challenge for us and you'll
see that our application is not terminated when we press key combination control C and when seek in
signal is sent to our node Jesus brought us it is sent directed to our process and notice that in this
command we have actually overridden default command does node command using custom command and we run
in the largest file using Node interpreter and we have also mapped port of our Express application and
we have exposed it to external port three thousand and we have also used the custom rocking directory
and we have mapped our local folder using this option and we have mapped to this folder to our folder
inside of the container.
Great lesson on what if I built our application and left at handling of the seek in signal.
I want to show you that that because it is important for understanding of how we are actually connected
to node brought us using Docker.
Let's go to our tiny application here and let's open up in the just file located in the Express folder.
Let me hide this left pane and let's add additional baggage here and it is actually default baggage.
No just package gold brought us and afterwards we will use this package for handling of the seek in
signal.
Let's do it.
Let's require additional package guns to process or require process like so and next.
For example here let's add following glance brought us on and here throws to argument will be sig int.
And second will be callback function.
I'll use our all function expression syntax again.
If you don't know no just syntax and don't know javascript please.
Never mind.
I want to just show you how you are able to handle seek in signal inside of the broadcast inside of
the container.
Okay let's add here our functional syntax like so and here inside of this are all function letters the
following.
Let's bring to the terminal message.
Application is being terminated through doors like so and here on the next line let's exit from the
process using the following syntax brought us exit and he'll let's call this method of the process until
it's past single argument 0 and it will mean that this process will terminate correct it with exit code
0.
Let's add one more line break here like so.
And that's actually all that we need to modify in our application to handle seek in signal.
Let's save this file.
Let's go to our terminal and actually we need to stop this container thrust and afterwards run it or
let's go here and let's at least contain the rules.
Yes and no let's use Docker Q command in order to quickly terminate brought inside of the container
because our application does not react to seek down comment as well.
Let's end our dock our keel and here we'll be at one view and container was terminated.
Let's go back to the step and let's rail run our application using same command.
And of course no our changes made in this file will be taken into account and our application should
now react to this signal.
Actually let me replace terminated with interrupted here because we actually interrupt our process.
Let's go back to the step and less around this comment and no this breath controls.
And now our process was terminated an icy text application is being terminated.
Basically it seems that I have to save the file.
Yes that is a case let's save it and also let's add the handling of the sick term signal into our application
as well.
Let me a copy of this blog based to here and here will be seek DRM and with those lines in place we
will be able also to use Docker stop comment that will quickly stop corresponding protest inside of
the container and TR lets that type application is being terminated.
Like so let's save this and let's now go back to our application here.
Let's clear a terminal and let's run our application control see I see application is being interrupted
and now process was terminated of course and there are no containers currently running Docker.
Yes and yes there is a case.
Let's run our container once again.
This actually brand new container.
And no let's go to the step daughter piece and let us know use Docker or stop command in order to Samp
seek term signal to our not just process Docker.
Stop.
And here let's use thrust of your characters off container iodine C1 and now container was stopped breeding
weekly.
And that's because we have adult handling of sick time signal to our obligation.
That's all for this lecture where I demonstrated you how you able to at handling of the sick and the
sick time signals to your application.
And again we are required to do so because we have connected directly to North GSK process after entering
such kind of comment node in the Lord Jesus.
We launch a specific file using Node interpreter and that's why we connect directly to node GSK process.
And actually I approved using those the lines of code that when you press control see Docker sends sick
ind signal to corresponding process and if you use Docker I'll stop comment Docker sends sick term signal
to corresponding process.
That's all for this show.
I hope that you enjoyed it.
And next you'll get a small challenge and you will need to create tiny nor yes application yourself.
I'll see you next.
Bye bye.