Microsoft Azure AZ-800 — Section 12: Create and manage containers

Microsoft Azure AZ-800 — Section 12: Create and manage containers

96. Understanding Windows Server containers

So one of the UP-AND-COMING technologies over these last few years that’s really kind of taken the world by storm is the feature known as containers.

Now containers is something kind of originated in the Linux world and eventually made its way over to the Microsoft world, and it provides a lot of flexibility and control over different applications that we would like to deploy, especially if you’re wanting to deploy it like a web based application rapidly.

So what is a container? Well, first off, containers can run on Windows operating systems or Linux operating systems. They’re very, very lightweight, virtualized environments, and they share the kernel with the operating system of the kernel being the thing that controls the processing and all of that for your for your operating system. Whereas with the virtual machines, you have to set up an entire virtual machine using all the disk space that it’s going to take with an actual operating system installed inside that virtual machine. And then you’ve got to install the application services, such as a web service and then the application files with a container. All you really need is the application files and some of the deal file system files that go inside of it to make it all work. And they can all sit on top of an existing operating system and they share the operating systems container.

So that basically means that, you know, if you’re if you are wanting to run a Windows based application, web application or something like that, you as long as you’ve got an underlying Windows operating system, that container can share the kernel with that Windows operating system, and you’re not having to actually install it into a whole new virtual machine.

So, it’s very, very lightweight and it can also be rapidly deployed.

So containers are very diverse. You can use them anywhere. You can create them on-premise if you want and then move them into the cloud. You can actually create them in the cloud and move them on-premise. You can essentially put any type of applications in there that you want. You can also support the various types of languages that are out there. Java Dot Net Python Note all that stuff is available for you to use. Containers are especially good for web based scenarios. This n’t necessarily one of those things you’re going to and you’re not going to install on like Microsoft Office inside of a container per se, but web based usage. This where containers are really going to shine.

OK, now as far as Microsoft is concerned, Microsoft, they originally started working on their own container software, but there was a company that came out years ago called Docker. Docker originally built their container system for Linux, and Microsoft just kind of fell in love with their their system, and Microsoft ended up giving Docker a ton of money in order to bring Docker into the Windows world as well.

So Docker did, and now Docker is not only the leader of containers within the Linux world, they’re also the leader of containers in the Windows world.

OK.

So with the help of that, we can develop, test, publish and deploy these containers. With the help of Docker, we can support the Visual Studio Visual Studio code, and we can support not only the Docker system that comes with Docker when you install it, but it’ll also, integrate with things like Kubernetes for doing what’s known as orchestration of your virtual machines, which I’ll tell you a little bit more about here coming up. You can. Then you can share your Docker container images with people. In fact, there’s a entire repository out there called Docker Hub, where people are creating these base images. These base image containers that you can share so you might have a container that somebody already built that has a web service in it that’s configured a certain way that you need it to work and you can download their container and use it in your environment. And of course, it’s all with moderators and all that.

So you don’t really have to stress a whole lot over people injecting malware or any of that in there.

So you get a lot of control.

So not only though, is this for on-premise, but it also can be in work in conjunction with the cloud. Azure supports container so you could set up containers on-premise just for testing and development purposes. And then you can upload those to the cloud and then from there you can scale them out on a on a very large scale. Microsoft supports what is called Kubernetes. Kubernetes was originally developed by Google to help handle the orchestration of containers, and Microsoft implemented their version of Kubernetes called Ake’s.

So with X Azure community service, you’re going to support massive orchestration, and what that essentially means is you could have, you know, let’s say you are hosting an entire eCommerce website with the help of Azure. And you needed to scale. Massive amounts of instances of your web service out there to be load balanced demands, hundreds of thousands of people. Well, that’s exactly what this for. As YouTuber, TT’s is going to allow the ability to generate these containers on the fly replicas of these containers on the fly and help you manage all of those. And you can have it to where when a certain performance level is reached in Azure, it scales out and generates more instances. And then when you don’t need that performance and scales back in, and of course, you’ll be billed based on what you use.

So, when you scaled out and you got lots of these services running, it’s going to cost more money. When it scales back, it’s going to cost less money. All right.

So how does containers work, actually? So, it’s really it’s an isolated little package. It can be kept in a single file in the container is going to sit on top of your underlying operating system and share the kernel with the operating system. This means that again, you don’t have to actually set up an entire virtual machine in order to do that. And that’s really the big difference. With a virtual machine, you’re having to actually set up an actual guest operating system, full operating system in there and put all the configuration in services. And there’s lots of things that can go wrong in a guest operating system. With a container, you get the container setup right and it sits on the underlying operating system and the containers can work the same way every time. And so that’s going to be, you know, one of your big, big benefits there. All right.

So containers are built off of container images. And again, you can get you can download existing container images off the internet from places like Docker Hub or you can build your own containers. You can even do that on a client computer if you want and then test it out there on a server. Microsoft has has word called base images that you can download that are that are free, that you can just download and start using right out of the gate. They have a Windows client based base image that you can use for creating web based applications for Windows clients. You got a Windows server, which is a full set, has all of the graphical components needed for server. Or if what you’re working with doesn’t really need graphical components, then you’ve got the Windows Server Core, which is a lighter weight version of Server and you’ve got Windows Server APIs as well that go along with that core that can expand out the dark net framework in if you needed to add some of the additional graphical support you could. And then lastly, we have Nano Server. Nano Server is the lightest weight version of container image. It’s a it’s a very, very lightweight handling only some of the most base my new things that are in the operating system.

So, if you’re trying to get the best processing power and you don’t really need a lot of the extra functionality and services that server offers, the nano server is generally going to be the way to go. All right.

So ultimately, Microsoft provides these. Like I said, free of charge. They’re right out there on the internet. You just have to know the commands in order to get them, or you can go in and download them graphically off their site. But ultimately, most everybody uses the commands to just simply download these and get access to these. All right. And so that is the idea behind container images. And of course, now we can go take a look.

97. Installing support for Windows Server container images

So the first step in working with container images is we need to install the containers feature in order to support containers, So, we’re going to do that by going to server manager clicking manage add roles and features. Next, next next. And then go to Features, which is on the next page here and you’ll see containers show up.

So as you can see, that’s not turned on by default.

So who’s going to simply click next and we’re going to go ahead and click to install? All right.

So this will take just a moment. I’m going to go out and play the video, one that’s installing.

OK, and it’s going to trigger a restart.

So tells you restart is pending, you must restart, is going to hit close. Go ahead and right click start and then restart. All right, so then after the restart, we can go back into server manager here, we should be able to go to manage admirals and features next, next, next and next and the containers is officially installed.

So, we now have what we need in order to start working with containers.

98. Getting Docker installed for Windows Server container images

So the next step of getting containers working with your server environment is to install Docker so that you have complete control and can utilize Docker containers now, obviously one thing you can do is you can open up your web browser and you can go to Gawker.com. This type of Docker .com. And from there you can go to Docker and you can download and install what you need to support Docker. However, if you are taking the exam, I’ll go ahead and let you know that the graphical way is not what they’re going to want you to be aware of. They’re going to want you to know how to do this from the command line.

So there’s just a few commands that I want. I want to look at with you, and I’ve got a nice little script for you that you can use for setting all this up. All right.

So here’s Docker, by the way. And you can create an account and download, but ultimately, Microsoft has all the commands for just getting everything you need.

So, if you open up the ISC? All right.

So, I go to PowerShell go and ISC, I’ve got this little command line script here that we can use for setting this up.

So the first thing we’re going to do is we’re going to install the Docker PowerShell commands to do that. We’re going to run this little line right here, so, I’m going to highlight that installed -module Docker MSFT providers is going to provide the PowerShell commands for Docker, So, we’re going to go ahead and run that and and let those commands get installed.

OK, slash forced just means it’s going to, you know, confirm that everything is OK to continue. It’s not going to prompt me.

Now it may also ask you to install Newgate. You may get a little pop up message. You can just click yes to that if you’re if you’re running this. But no, that’s installed. It takes maybe about 30 seconds to install usually. And then we’ll come down to here. This we’re going to install the Docker package itself.

So, install -Package Docker provider name. This actually going out to the internet, by the way, and downloading the Docker package that’s been made available by Microsoft with the help of Docker.

So, we’re going to go ahead and hit play on that line as well. We’re going to let that go ahead and run through at that point. Once that’s done, and that takes about a minute to install. But once that’s done, you now need to restart your computer. And of course, you can do it graphically, or you can use a little script to do it, and we’re going to go ahead and let it restart. Kept the server has restarted here, open back up the ISC, and in that point, I should be able to go ahead and just start the Docker service, start -Service Docker. Let’s go ahead and just run that and then we want to make sure that Docker works.

So, we’re going to run Docker version. And it should show us the version of doctor that’s installed on our server, as you can see, it has that listed here. And we also can look at doctor info as well. And we after that, after we take a look at our darker info, we’ve pretty much confirmed at that point that the doctor is officially installed and there it is there.

So some doctor info shows you some information about the doctor that’s installed on the machine tells you right now we don’t have any containers, nothing’s running.

So, it’s just giving you some information about the doctor service itself. But currently we don’t have any containers running, So, it’s just confirming that it is there. But ultimately, at that point, Docker is officially installed. Of course, you would also want to install Hyper-V. I’ve actually already got Hyper-V installed on my machine, so, I don’t have to install Hyper-V. But if you were doing this and didn’t have Hyper-V installed, you’d want to go ahead and install Hyper-V so, it can utilize the virtualization capabilities of Hyper-V. But ultimately, that is how we get Docker initially installed on our server.

99. Pulling Windows Server base container images

After Docker is officially installed on your server, the next step is that you need to pull a Docker based container image, the Docker based container image should match the version of server. If you got a full version, a server you want to do a full version server container, you’re going to need a base container to match that.

Now you can go out on to the internet and you can do a quick search to look at the different container images that Microsoft makes available to you. All I have to do is just go out to, for example, Google. If I go up to Google, I can just do a search for Windows based container images and we can see what’s available. Let’s do a quick search on that. And Microsoft has articles out there that will tell you what your face container images are available to you. And so like, here are the four they’ve got listed there. I’m going to go with this one here. Windows Server so, I can click on that if I want. And Microsoft, give me information on Docker Hub here, hub, Docker .com. I’ve got some information on what needs to be typed. Here is the information right here which, as you can see, is going to match with what I’ve got right here, right? So that’s how I did that. If you wanted to change the container image, if you could just go to a different Taner, you can see what the line needs to be for pulling that.

So here we go. We’re going to get Docker image. We’re going to just highlight this and it’s going to hit this line right here and be advised that this where things take time.

So, when you hit play on this, you better be ready to wait, depending on how how slow your internet connection is, how fast your neck and a connection is. This can take a while, so you want to be patient on this. All right.

So, I just pulled the trigger on it, and it’s now officially going to go out there in and pull this information.

OK, so after pausing video, this done officially. And you can see ran through and downloaded everything it needed.

So now I’m going to go right here and run this command, says Docker images. And we’re going to take a look at what we got. All right.

So, I put Nano on here at another point, but this the one we want to look at this very first one right here. All right, so, we have that, we have that official server set up here with the image I.D. tells you this image was not that was actually not updated very long ago, says three weeks ago in my case.

So of course, fitting home when you’re doing this video, it may say something a little different for you if you’re doing this with me. All right. And so at that point, we’ve we officially got that go in, and if we want to run a container image, then these are going to be the lines that that we would use to run it. And I’ll show you that in the next video.

100. Running a Windows Server container image

Now that I have the Docker based container images installed, I’m now ready to try testing out one of the base images that I’ve set up now when I run this, I’m not actually going to run this from within the ISC because the ISC, I’m going to actually tell it to open up a command prompt on this base image.

So, it’s going to load the space image up into memory as a container, and it can’t run from within the IEC version.

So, I’m going to copy this right here and then I’m going to right click start and go directly into PowerShell. And we’re going to paste this in now, keep in mind, it’s going to take a moment to run that base container image.

So while that’s running out Paul’s the video in wait on it to pop up.

OK, so after a moment, I get this prompt here and I’m now inside this base image, just like I’m in command prompt by Type D air. You can look at the actual folder structure that’s there. I can actually go see and slash users D.R. and I can see, as you can see, you can take your administrator as their side. Dot Dot, I can navigate this file system. There’s even a license there I can look at. All right. Tells you the license for containers in regards to what we’re using here.

OK. Notice that Docker Docker is not installed inside the container, so you can’t actually run a Docker command inside that container. You know, interestingly enough, if you type PowerShell, then it attempts to load PowerShell and it’s a little bit sluggish because it’s only got a certain amount of memory available to it. But as you can see, it is trying to load a PowerShell. And at that point, if I’ve tried typing Docker from within PowerShell, it’s a little bit sluggish. And eventually, we get an error because doctors is not installed in the container even within the help of PowerShell. I can tell you by config I can actually see what my IP address information as you can see that the container creates this little.

So, we’ve got this IP address that it’s it’s going to use. And by default, the container will have network access, which is kind of cool. All right. All right.

So, we’ve we’ve now officially connected into into our container and we got this other little command here, which says Ping, local host. This going to verify network connectivity. I’m going to copy that and we’ll paste that in there as well. We need to exit out of the container first, so, we’ll exit out of it by typing exit. And that gets us out of PowerShell and then typing exit again. This going to exit the container. And so the container will no longer be. I’ll no longer be connected into that container.

So now I’m at a pace that line in and I should be able to successfully run that. And of course, that will take a moment to to run. And as you can see, it is it’s making a ping, it’s pinging the local hosts. It’s actually pinging the IP version six address.

So, I’m able to essentially run commands directly into the container. If I want to go direct, connect directly into the container, I can run that last command that I showed you, which was the CMT command. But ultimately, if I want to run commands against the container, I can do that as well just by running this command here. All right.

So that is how I can very easily interact with that container and run commands and utilize commands, which as though I was at a prompt, a command prompt or a PowerShell prompt inside that container.

101. Configuring network settings from within a container image

I want to show you a little bit of the configuration from with inside of the container, so, I’m going to go back into PowerShell here and we’re going to run this line here. That’s going to let us get into the command prompt with Docker, and then I’m going to go into PowerShell, which of course, gives me access to all of the PowerShell commands that will help me control the container as well.

So, I’m going to go into PowerShell just by simply typing PowerShell. That’s going to bring me into PowerShell itself.

So and of course, I’ll have access to all the PowerShell command. Let’s first of all, I just want to see what settings are installed or what features are installed on the container.

So, I can say get -Windows feature, I can hit Enter, and that’s going to show me what features are currently installed. It’s going to list those up.

OK, so there they are, just kind of scroll up, you can see the things that are installed here. Dot net framework.

So there’s quite a few things here that are missing, but there’s also quite a few things that are there, such as the file and storage services and all that. And as far as networking goes, there’s network policy access servers. That’s not their network controller, which. It was used for something called software defined networking is not installed.

OK, so, If we wanted to. We could install Windows features, right? So, we can if you try typing, install -Windows feature, you can install a particular Windows feature you want.

OK. Perhaps I want to install the web service, for example.

So, if we kind of look through here, you’ll see web services web -server. Right? So, if I say web, the -server, we can hit and run on that and it’s going to go through the process of trying to install that web service on the machine.

OK, but ultimately, what I want to show you is I’m going to take a look at my IP settings. I can type IP config and I can see my IP address settings here. If I do IP config slash all, then it will show me all of the IP information that is listed here. All right, so let’s type that out. And there it is. I can see that this a static address. It was not issued by DHC. It was a static address.

So, if I type get -command. For. -now on. Star net star, that’s going to show me every command, it’s got the word net supported from within PowerShell here, and as you can see, I can configure my adapter settings to pretty much anything I want.

OK.

So, for example, if I wanted to change my IP address on the network adapter, I can use the set -net IP command. Right.

So, if we look up here set -net IP address, I can change my IP address to whatever I want.

So as far as configuring your IP settings within container, you can basically set those any way you want.

OK? And configure those anyway you want. And keep in mind, you can get if you go out to Docker hub. If you go to Hub Dot Docker .com, you can go right here and click on Explore and you can see the abundance of containers that are available to you. If I just want to see windows, containers, for example, I can do that and they have some very generic containers. These are highly rated, of course. You know, they’re all moderated, so you don’t worry about malware and all that. Like, for example, here’s one that’s just a Helloworld web site. It’s just a very minimized web service if you just want to set up a web server. This a great one that you can download and you can configure it. But ultimately, the thing is important there is. Once you do get all of that, you’re going to want to adjust the networking settings the way you want. And there’s a couple of ways you can do that. One way is from within the image like I’m showing. You can also download something called Docker Compose, and it’ll let you edit something known as the Yamal the manifest, which will let you configure what the container is going to start up as which I’m not getting into here, but you can download Docker compose and you can adjust the network settings of what the container is going to start up with. Or you can go into the container like I was demonstrating, and you can just adjust the settings the way you want.

Now a big part of obviously being able to control your settings. Your network settings within a container is understanding PowerShell command.

So you know, I encourage you if you haven’t already watched the PowerShell videos in the course you should have or you should do that. But ultimately, if you do go to a command prompt and Typekit -Command -now start at star. You can see all the network related commands that PowerShell has to offer. And you can run those from within the container so you can adjust your settings to whatever you want.

Now I can also, if I don’t know how to do something like, let’s say, I don’t know how to change my IP address from within the container using the PowerShell command, the set -net IP, all you got to do. Go to Google and then do a quick search on set -net IP address, and you can pull up the article on that and you have examples on how to use it and all that fun stuff.

So, I encourage you to kind of take the plunge on that and and try that out. But you just see if you can adjust your IP settings there and you know, if you don’t know how to do it, just look up the article because there’s an article for pretty much every single command. Look at all these articles over here changing the network interface, changing routes. You know, all of this stuff is all these commands are ways that you could modify that container network settings. But at this point, I want to encourage you, jump in, try downloading some of the containers off of Docker hub, play around with that and get some hands on experience with it.