7 hours 58 minutes
Welcome back. In this episode, we're gonna take a look at a demo using containers.
Our objectives include we're gonna create a container registry, and Azure will create a docker image and uploaded to our registry and then deploy it to a Web app
before we get started. Most of our other demos have only required access to the azure portal. And using resource is in there for this demo. I do want to point out I am going to be using Docker desktop on Windows. And here is the euro for it to download and install. If you're using a Windows PC
and you will want to configure it for Lennox Containers, you very well could configure for windows. But in the demo here, I will be using just a Lennox container.
Now let's get back out to the azure portal and take a look
back here in the azure portal. First thing we need to do is create a container registry that we can upload our doctor container, too.
So first, let's create a resource
will select containers
and container registry.
We'll need to give a registry name, and if you notice it has a suffix of dot azure cr dot io. So this does need to be a globally unique name.
I'm going to select an existing resource group I have created called Docker Dash R G.
I'm gonna leave the location as East us.
And for this registry, we're gonna enable the admin user so we can use a user name and admin user key as our log in
and the registry does come in, a couple available skews. Right now, we're just gonna stick with standard.
Let's go ahead and create our registry.
And here we are inside of our container registry that we just created. There's a couple of things in here we need to take note of before we continue.
First, I need to copy the log in server name. This is the name we just used when we created our registry.
And in order to log into this registry later so we can upload our doctor image. Let's go to settings and access keys.
And here I'm gonna copy the user name and the first pass word to use in our demo later.
Next. Let's go take a look at the application. We're going to create a docker image for
here. I have these same know Js hello world Web app that we used in our previous demos on Azure App Service's and Web APS
and I have a new file here called a Doctor file.
This is basically just a list of Dr Commands that's gonna tell Doctor how to build our image.
Let's also go look at our index dot Js file and I want to note that instead of hello world, I have hello container app just so we can tell it's a different Web app than the ones we previously built.
Harry, um, in my power show window. And I've already navigated to the folder that has our application in it and our doctor file. And I've already installed Docker desktop for Windows on this system. Just remember to go back and install it yourself if you want to follow along this demo.
So first we need to build our doctor image. And to do that, we're going to run this command here.
I'm going to say Dr Build
and we're gonna prep end it with the same name as our azure container registry,
and we just need to give the application of name
and then the dot here just says include everything in this folder that I currently have with our application files.
Now, I got just a little bit of a note here saying I have a locked file and I forgot to close out of my index dot Js inside of my code window. So let me do that real quick
and let's just rerun are built to make sure it runs correctly.
So let's take a look at the image by running Docker images Command,
we could see right here the image we just created in our local repositories.
Now that we have our image, we need to log into our azure container registry so we can push this image to it.
To do this, we need to use the doctor Logue in command,
the name of our remote registry,
and here is gonna prompt for a user name and password. And this is the user name and password we just saw in our access keys just a few moments ago.
Now that we have our image created and were logged into our remote registry, we just need to push this image to it.
Well put, Doctor push
and the name of our image
and we could see Doctor is pushing the different layers of our application up to our remote registry.
Now that the push is complete, let's go back to our portal.
We go down under Service's and select repositories.
We can see our know Js hello World image has been uploaded here.
So now that we have an image, let's go overto app service is
and we're gonna create a new Web based on top of this image.
It's like my doctor resource group.
We need to give our Web app a name.
And previously, when we're deploying our Web APS, we selected code. But this time we're going to select Docker Container. We're gonna run it off the Lenox operating system,
and we're gonna choose the same region that the registry is deployed to.
I'm going to use thes, say, map service plan that I created previously
and next. Let's go to Dr
and here. Under image source,
we can select our azure container registry
and firmer azure container registry is gonna pull up the image that we just created.
So let's go ahead and click on review and create,
and we'll wait for a deployment to finish.
Let's go to our resource now that it's been deployed
and you'll see this Web app is pretty much the exact same looking as the other ones that we created. Except now, as the Web has been deployed, it already has the code in the application based off the doctor image that we created. So if we go ahead and select on Brows,
noticed, the Earl has our dash doctor app on it this time, and it has the code that we looked at earlier. Where says Hello container app.
So in our last demo, with just Web APS, we had to create the Web at first and then find a way to upload code to it. You know, we could do that from Get Hub or some other source in our case, in our demo, we just uploaded it through FTP. But using a docker image, we can deploy the code immediately. When we create the Web app.
You can also configure integration toe where if you change your application and update the doctor image and push it again, back up to the registry, it will auto update here inside the Web app, so you don't have to manually come deployed again.
That does it for our containers demo. Let's jump back to the slides and wrap this up,
but does it for this module. It's a little bit shorter than what we've been working with before. Coming up next, we're gonna jump into our next module, talking about some authentication and data security concepts with an introduction to authentication.
See you in the next episode.