 Howdy, Mike Morton here, Program Manager on the Visual Studio Team. In this video, I want to show you some features in the Docker extension for VS Code that make it easy to build and deploy containers in Azure. First, I have heard from a number of users, they are not aware the Docker extension can help them easily scaffold the Docker file and optionally a Docker compose YAML file as well. So let's get started. Here I have a very basic .NET Core console app that processes orders. Let's add a Docker file to it and run it as a container locally first. So I'll go ahead and bring up the command prompt, and I will type in Docker add Docker files to Workspace and go ahead and select that. First thing I'll be asked is for my application platform. You can see we support .NET Core, Python, Node, and others. I'll go ahead and choose the .NET Core console, and now I'm asked which operating system I'd like my container to target. I'll choose Linux. This is where I'm asked if I would like to include Docker compose files or not. Docker compose files are real handy if you're going to maybe spin up multiple containers at once with a Docker compose up command, or even if it's just a single container and you have a number of flags for maybe environment variables and volume mounts. For now, I'll go ahead and select no. So now you'll see here we have our Docker file that's been added to our project, and I'm going to go ahead and build that Docker file. Docker file basically gives instructions for how to build the Docker image. So I'm going to go ahead and just right-click on the Docker file and say build image. Then in the terminal window, we'll be able to see the different steps that Docker is going to run to actually build that image. First, it will pull the base image, which is here in this from statement, and then it'll process the other steps as needed. When that's done, I'll go ahead and click over here on the Docker, what I call the Docker whale, or the Docker Explorer, and we'll see in our images that we should have a new image, a new order proc image. Here we can see just a few seconds ago that was created. So now we have a Docker image that's been built and it's stored locally on our machine. Now we want to go and we want to run that. So what I'm going to do is I'm going to right-click on that and just say run. And so that's going to execute this Docker run task, as you can see down here, and it's going to spin up the order proc image. And you can see in the containers panel here that that's been updated, and you can see that that order proc container is running. And now we can do things to investigate, to maybe look at the logs or inspect the container. I can right-click and do a number of options. I can start and stop, some things like that. I'll go ahead and view the logs and we'll see that this order processor is doing its job, it's cranking away, processing orders. Okay, now let's start using Azure to do this. There are times when you want to just try your app running in a container in the cloud to make sure it's going to work like you think it will. So let's do a couple of things here. First, let's build our Docker file again and create that image. But this time, let's use Azure to do that. So I'm going to go ahead and click build image in Azure and it's actually going to use ACR and ACR tasks to build that image. And it's actually going to then tag it and store it into my ACR registry. I'll go ahead and say this is great for the name and the tag of the image. And I choose the ACR that I want to use. ACR is Azure Container Registry. I could create a new one, but I'll go ahead and use the one I have. And again, select the image that I want to build, which in this case is Linux again. So now what's going to happen is my source code and the Docker file is going to be shipped up into ACR and it's going to build a image. And then like I said, it's going to store that image when it's done over here in my ACR registry. All right, so let's go ahead and expand that. And there's our order proc. That's one I built a few months ago. Let's go ahead and wait a couple of seconds for this. Okay, I fast forward 30 seconds or so. And if I come here and refresh on my registries, I should see that we have a new order proc image. We do. It's been labeled CA9, which is just a unique identifier for the tag. And now if I want to go ahead and deploy this to Azure, let's go back over to the terminal. I need to make sure, and I'll go ahead and get rid of that terminal from before. And I'm going to use the Docker login to Azure command. I need to make sure I'm logged into Azure. So here I'll go ahead and give it my credentials. And now you can see that I'm logged into Azure. That's great. I'll go ahead and go back to here and we're logged into Azure. So now what I could do is I could use the command line to interact with the ACI or Azure. And in fact, the way I do that is by using Docker context, which is something that has been around for a while that you can use to talk to remote Docker daemons. But Microsoft and Docker have recently worked together to enable deploying to ACI using these Docker contexts. So we have these new ACI contexts, which are like a type of cloud context. So we'll go ahead and use one of those. And again, I could use the Docker CLI to create that context and do Docker run and so on and so forth. But what I'd like to show you is how the Docker extension has made this easier. So I could manually create a context here if I wanted to, but let's take the shortest path and let's just right click here and deploy this image to Azure container instances and use that new integration that Docker and Microsoft have done. I'll click on that. And the first thing I'm gonna be asked for is to create a new context. So I'll go ahead and do that. And we'll just call this, let's call it my ACI context. Keep it real simple. What I need to do is I need to select a resource group. If you've used Azure much at all, you know, resource groups are really just kind of a grouping to put your resources in to kind of keep track of them and manage them. I'll go ahead and use an existing one. I have this My Containers Resource Group. I'll go ahead and use that. What's gonna happen now is you'll see down here in the context panel, just as if I had clicked the plus sign, a My ACI context was created and it was actually switched to be the current context. You can tell that by the plug. And then you'll also see that the extension has done a Docker run. And it says, hey, I wanna run against, I wanna run this image, which as you can see is that order proc CA9 image right here that we built just a few minutes ago. And so what's happening now is it's spinning up that container right inside of ACI. So I fast forwarded a little bit. Typically these take 25 to 35 seconds. As you can see, this one took just a little bit longer. We can see the containers that are up in that context. Basically, this is a container that's running up in Azure Container Instances. And I can do very similar things that I could locally. I can do things like view the logs again. So let's view those logs again. And here you'll see that we're processing those orders just as we would expect. I can also do things I can inspect that. I can inspect that container and see what's going on. And of course, I can start and stop that container. And just to show you that this really is using the same Docker commands. If I do a Docker PS to list the running processes, you'll see that I see that same distracted Morse, which is this one here, which is running up here, which is the order proc CA9. And so what the extension does is it just makes it so you don't have to know all of those Docker commands. And so I can just right click here and I can say remove that. And what's great about ACI is as soon as I remove that instance or that container that's running, the billing stops, ACI bills by the second. So now I'm not being billed at all. Okay, so that's the basics for using the Docker context, the Docker ACI context. Like I said, I can create multiple contexts. So if I click here on the plus sign, I can create a second context. So this is my second ACI context if I want to and I can choose a different resource group here. I'll just choose my France central resource group. And now I have two different contexts and I can switch between those contexts. So if I switch to this context, you'll see I have no containers running. And of course, I can switch back to my default, which is my local context. And I can say I want to use that context. And when I do that, you'll see that I see the local containers and the local images that are on my local host machine. Well, let's do one more thing. Let's go ahead and go back to our ACI context here. And I'll go ahead and say, I want to use that. So I mentioned that we can use Docker run and that's what was used when I ran this here. You can see that we did a Docker run command. I can also use Docker compose. So now that I have my context set to my ACI context, I can come over here. And even though I didn't add a Docker compose file when I scaffolded the files, I have one in here ready to use. So I could show you this. And here you'll see that not only am I gonna spin up that same, actually, let's change that. Let's change this to what was that CA9. Let's change this to CA9. That's the image I just built. You'll see I have another image that I'm pulling, which is my express app. I'm just using this as a sample. This is actually gonna be a little express app that's gonna open on port 3000. And I'm doing that for a reason so I can show you another neat feature. And so now I can just go here. Again, because I'm pointing to my ACI context, when I do a compose up, it's actually gonna run this Docker compose, the same Docker compose that I would run locally, but it's gonna run that against that ACI context. And what you'll see is I'm actually gonna get a container group that's made up of these two different containers and are gonna be in that same container group. Container group is an ACI context. Every container that you run up in ACI goes into a container group, but you can have more than one. In this case, I'm gonna run both of these containers in that same container group. Very similar to a pod within Kubernetes if you're familiar with Kubernetes. So these containers are getting spun up in ACI and we'll give them a few seconds to finish here. All right, so those containers are now spun up. We'll see that this is the order proc, same order proc as before. And I can view the logs just like we've seen before. There's those logs coming out of Azure down to my machine so I can keep an eye on that and see what's going on. I also can do other things such as with this Express app because it has a web app to it. I can actually open this in the browser. And when I do that, it's actually gonna open up to that public IP that was exposed up in ACI. And here's my Express app running up in Azure. All right, well, thanks so much for listening. I hope this was helpful. Please leave any comments down below and we'll hopefully see you in another video soon.