Hello and welcome back.
In this lesson we're going to learn how to persist.
Data is not web server container.
Well these may be pretty pretty useful for development environments.
So say that you are a web developer and then you want to use doctored to develop your site.
So what you can do is that you can install Docker on your own machine.
If you're using linens or it doesn't really matter.
So you can create a folder with your team e-mail files or with your code with your web code and then
you can map that file chewed a container and then you can just start applying changes to your code and
at any time that you save any file which is mapped to the container it will be automatically refreshed
in the container itself and you can use any text editor that you want you can use to blind at home or
whatever it's going to work.
Good.
So it's going to be a cool tip for developers.
Okay.
So I didn't have a text editor here because I remembered that I'm using a remote machine so I will use
the Linux Ed which is nano or VII.
Okay.
So now let's take a look at our containers.
I just removed all of the containers and say that I want to create a new project because I will create
a web application on our Web page and then I will just create a directory.
You can just create it in your laptop and these will be web and that's cool.
I'm going to be the one who uses it.
So say change counters centers send toes to the Web folder that I created.
Great.
And now I can just start creating files here.
So save that I just created these new folder for my project and I want to create an index that edge
Tamil file.
You can use sublime or whatever you want to create it because it's going to be created on your host.
You can just write your code here normally and then say that we want to say hello world but you can
you know you can type all of the metadata for each team mail all of the tags and all the things that
unit.
In this case it's going to be super simple.
Okay.
I'm a developer building this side and I'm saying hello world cool.
So this is my edge e-mail file.
So now what I want to do is that I want to run it in the dock for a container.
So I will create a new container for example use in engine X and I would say Docker run dash D dash
dash name engine x.
And then I can map a them because I already created my directory.
So it's mount whip because in the web I have all of their files for my project.
In this case I have the index file and I want to map these files to user share engine x h t email because
these folder is the default location for any next.
And in this location and next serves all of the files.
So now the only thing that we're missing here is the name of the image says Hey Indian x all pine.
Okay.
So Dr. Pierce and we have a problem because we didn't expose any port so let's remove these container
again my bad and let's expose the port.
So we want to export did import 880.
And remember the engine next runs on port 80 on the container.
So if we hit enter then you see that if you have your container you see that you have your port opened
and now it's time to go to the browser.
So if you open it and you go to your IP address ADHD then you are going to see your halo application
right.
But remember that this code is being taken from your host because we applied a bowling boom from your
project to the container.
So now you want to modify your code and you want to add more functionalities or you want to add more
codes to we say here more crude and more stuff and we can save face.
Let me save this kid cannot save it.
Why.
Okay cool.
And then remember that I'm outside of the container if I type Docker.
P.S. I can see all of the containers but I just modified the file which is in my machine on my laptop
or my personal computer on my doctor host.
And once a modified acute remember that all the changes that will cure in this folder will be affected
inside of the container and all of the changes that a cure in the container in that folder will be modifying
these code or data.
So I mean if I create a file here then they file will be inside of the container if I create a file
inside of the container then the file will be here.
So let's refresh our page and cool using mercury and a staff rate.
So say that you want to create an order page so you can create an order file and you can say Page 2.
And that's going to be your page to that h t email.
And if you take a look at your file which is on your computer using the code and not these files should
be created inside of the container.
Because remember that we are mapping these folder to this folder instead of the container.
So if you go here and you type test okay things.
Page two that each team l you will see code which is page two and this file was created by you in the
directory of your Docker host which has been mapped as a volume to the container.
So this is super cool.
I hope that you have learned how to use volumes you know web server and how to use your honest tap how
to modify your own code so that it gets modified inside of the container.
This is it for this video.
I'll see you in the next lesson.