Overview
Note: The lab component has been removed from this Skill. However, this skill still retains value as a training resource.
Container Installation Requirements and Scenarios
This Nugget covers the basics of containers and how they work in Windows Server.
Knowledge Check
Hyper-V containers share the container host's operating system kernel. True or false?
Installing and Configuring a Windows Container Host
Learn how to stand up a Windows container host by enabling container support and installing Docker.
Knowledge Check
Installing Docker through PowerShell automatically installs the Windows Containers feature. True or false?
Configuring Docker Startup Options
In this Nugget, you'll learn how to configure Docker startup options using a configuration file.
Knowledge Check
Which configuration file is used to define Docker startup options?
Installing a Base Container Image
This Nugget will show you how to pull base operating system container images from Microsoft's Docker repository.
Knowledge Check
To download and install a container operating system image, which Docker command is used?
Creating Windows Server Containers
In this Nugget, you'll learn how to start, stop, attach, inspect, and remove containers.
Knowledge Check
To create and run a new windows server container, which Docker command is used?
Creating Hyper-V Containers
In this Nugget, you'll learn how to create Hyper-V containers and see how they differ from Windows Server containers.
Knowledge Check
To create and run a new Hyper-V container, which Docker command is used?
Deploying Windows Containers Lab
This hands-on lab Nugget gives you access to our virtual lab environment and challenges you to complete many of the tasks Garth performed in the Deploy Windows Containers section of the 70-743 exam.
Knowledge Check
To run Hyper-V containers on Windows Server, which of the following is required?
Managing Windows Containers using Docker
This Nugget will show you how to create, tag, manage and work with Docker images.
Knowledge Check
To create an image from a container, which Docker command is used?
Creating New Container Images using Dockerfile
In this Nugget, you'll learn how to automate the process of building container images using a dockerfile.
Knowledge Check
To create and automate images from a dockerfile, which Docker command is used?
Managing Container Networking
This Nugget will cover the basics of container networking and show you how to create custom container networks and attach containers to them.
Knowledge Check
A _____ container network allows containers to join the physical network.
This interactive assessment is available in the full learning experience.
Managing Container Data Volumes
In this Nugget, you'll learn how to share data between hosts and containers using data volumes.
Knowledge Check
Which Docker command allows multiple containers to share a data volume?
Managing Resource Control
In this Nugget, you'll learn how to place resource limits on containers.
Knowledge Check
Which of the following limits can be placed on containers?
Managing Container Images using DockerHub Repository
This Nugget covers the purpose of DockerHub and shows you how to push images to and pull images from a DockerHub repository.
Knowledge Check
To push and pull images from a DockerHub repository, which command must you run in Docker?
Managing Container Images using Microsoft Azure
This Nugget shows you how to use Microsoft Azure's Container Registry service to store and manage images in the cloud.
Knowledge Check
To push and pull images to and from an Azure Container Registry repository, which command must you run?
Managing Windows Containers Lab
This hands-on lab Nugget gives you access to our virtual lab environment and challenges you to complete many of the tasks Garth performed in the Manage Windows Containers section of the 70-743 exam.
Knowledge Check
To automate Docker image builds, which file must you create?
Conclusion
I hope this has been informative for you and I would like to thank you for consuming.
View Transcript
Container Installation Requirements and Scenarios
0:00Containers are the next logical step
0:02in the world of virtualization.
0:03In this Nugget, we're going to talk
0:05about what they are, who uses them, their intended
0:07workloads, and the requirements for running them.
0:10To understand the need for containers,
0:12we need to go all the way back to the beginning.
0:14The beginning being physical machines.
0:17Prior to virtual machines, we would load up our data centers,
0:19server rooms, and server closets with physical hardware-- towers
0:23and racks to support our workloads.
0:25We'd have some machines dedicated
0:27to a specific workloads, other machines
0:29containing multiple workloads.
0:31But the point is, everything was physical.
0:33Eventually, we realized that this isn't a very efficient way
0:37of doing things.
0:38It's a waste of resources, a waste of power, a waste of time
0:41and energy, and, on top of that, these workloads
0:44weren't very portable, so it was difficult to move things
0:47around.
0:47So along came virtual machines, which
0:50solved many of the challenges that we
0:52had with physical machines, specifically around resource
0:56utilization and power consumption.
0:58We could pack VMs onto a physical server
1:00to make better use of the resources within.
1:02However, there are still some challenges
1:04that virtual machines didn't solve.
1:06And that's because they're thick.
1:08We still need to install an operating system,
1:10configure it, manage it, get our workloads on it,
1:12and they're still not very portable due to their size.
1:16That's where containers come in.
1:18So it's easy to think of containers as operating system
1:21virtualization.
1:22Containers themselves provide an isolated environment
1:25for the workloads we need to support.
1:26Those workloads primarily being applications and services
1:30along with all of their dependencies.
1:32Hosting a website being a prime example of that.
1:35We could install IIS into a container,
1:37add in our application and all of its requirements
1:39and dependencies, and we now have a box containing
1:42all of those components that we can easily move around
1:46from server to server, data center to data center,
1:48and even cloud to cloud.
1:49Now, containers are made up of images
1:51layered on top of each other, very much like an onion.
1:54So you begin at the center with a base operating system image.
1:58We fire up a container based on this image,
2:00we get into it, we make changes to it,
2:02and create our own layer on top of it.
2:04Say, for example we installed IIS.
2:06Then we do it again.
2:08Add another layer containing our application
2:10and all of its dependencies.
2:12These image layers function very much like differencing disks.
2:15When we spin up a container based on an image,
2:18any changes we make within that container
2:19are isolated into the sandbox, which is then
2:22used to create new images from.
2:24Here's the really neat thing about containers.
2:26We could be creating hundreds or even thousands of containers
2:29on a single machine all containing different workloads,
2:32but all of those containers still share that operating
2:35system layer.
2:36In fact, the operating system kernel
2:37is actually projected into these containers.
2:40And that's the operating system virtualization part.
2:43These containers essentially have their own copy of that OS
2:46with their own file system and everything.
2:48And again, all those changes we make within
2:51are isolated to the layers above.
2:53Now, we have two flavors of containers
2:55in Windows Server, Windows containers
2:57and Hyper-V containers.
2:59Windows containers are what we were just talking about here,
3:02where the operating system is shared,
3:05or the kernel of that operating system
3:06is projected into all of these containers.
3:09In fact, on your container host, if you
3:11were to run Task Manager, you would actually
3:13see all the processes that these containers expose,
3:17because that kernel is shared amongst them.
3:19So the downside here is, if the kernel was ever compromised
3:22by a container or otherwise, all of our containers
3:25on our container host would be affected.
3:27Hyper-V containers take that a step further
3:30by providing our containers with their own copy of the kernel.
3:34This results in the best security and isolation
3:37possible, but it does, of course,
3:39require Hyper-V installed on your container host.
3:42Now, there are a couple of requirements for standing up
3:44a container host.
3:45One of them is the containers feature in Windows Server.
3:48The other one, the big one here, is Docker.
3:51Docker consists of two components, a daemon which
3:54runs as a Windows service, and a client
3:56in the form of a command line interface
3:58that we use to interact with that service.
4:00Both of these requirements are easily
4:02installed in just a few lines of PowerShell code,
4:05which is what we'll be doing in the next Nugget.
4:08In this CBT Nugget, we covered the purpose and benefits
4:10of containers, and talked about the requirements
4:13for standing up a container host.
4:15I hope this has been informative for you,
4:17and I'd like to thank you for viewing.
Installing and Configuring a Windows Container Host
0:00In this Nugget, we're going to look
0:01at how to transform a Windows Server into a container host
0:04by enabling the containers feature and installing Docker.
0:07Here we are on CN-NUG, which is going
0:09to act as our container host.
0:11Our first mission is to get these requirements installed.
0:14Those requirements are, again, the containers feature built
0:17into Windows as well as Docker.
0:19Now, let me show you that feature first.
0:21Let's head into Server Manager, dropdown the Manage menu,
0:23choose Add Roles and Features.
0:25And I'll just fly through this until we get to features.
0:28One more, there it is, and you'll
0:30see containers right here.
0:32Now you don't actually need to do this,
0:35because if you install Docker through PowerShell,
0:37it will automatically install this feature for us.
0:40But the only reason you'll need to do this right here
0:43either through the GUI or through the install Windows
0:45feature chameleon PowerShell is if you're
0:47installing this on a machine that
0:49doesn't have internet access.
0:50So you would download Docker manually, and then
0:53install both Docker as well as this container features
0:56separately.
0:57All right, so we're actually going to skip this.
0:58Because we're going to do all of this
1:00through PowerShell, so let's get the Integrated Scripting
1:02Environment up here.
1:03And to install Docker through PowerShell,
1:05it's a couple of simple commands here.
1:07One, to install the Docker Microsoft provider
1:10from the PS gallery repository.
1:12Once we have that installed, we can pull the Docker package
1:15from that repository.
1:17So we're going to run these both in one shot.
1:19The second one, I added the verbose flag onto it,
1:21so we can actually see what it's doing.
1:22And you'll see that it's going to install that containers
1:25feature for us automatically, so I'm going to run both of these.
1:30We'll get a little message here just
1:31verifying that we indeed want to install Docker.
1:34I can tell that the first command already completed here,
1:36because the second command is outputting
1:38all of its step via the verbose flag there.
1:41So I'm going to hit yes to all here,
1:42and now it's going to finish installing.
1:44And check that out, installing containers.
1:45That is the step that it's doing right now in the background.
1:48It is installing the containers feature.
1:50A few minutes later, and that install finished up.
1:52If we scroll back up to take a look at the output,
1:54we can see that it finished installing containers.
1:56And then it downloaded and installed Docker.
1:59In fact, we can look in this directory just
2:00to verify that here.
2:01If we head into File Explorer, I'll head into the C drive
2:04here.
2:05And from here, Program Files, and there
2:07is that Docker directory.
2:09And here it is.
2:10So you've got Docker D, which is the Damon.
2:12This runs as a Windows service.
2:14It does all the heavy lifting, and then
2:15Dr. Docker.exe, which is our CLI command line
2:18interface for managing all things containers.
2:22Now before we go any further, we should respect this message
2:25here.
2:26The head of restart is required to enable the containers
2:28feature.
2:29So I'm just going to force a quick restart
2:31and come right back.
2:33And we're back with our new container host.
2:35Let's jump back into the ISE.
2:37A couple of commands here we can use to verify the install.
2:39We can run the Docker client here passing the version flag.
2:42This will give us the current version, which is also useful
2:44when you want to perform, and update, and compare versions
2:47with what's out there in the Docker repository versus what
2:50you have installed locally.
2:51You can see we're on version 18.09.2.
2:54We can also run and get service to verify that the service is
2:57successfully up and running.
2:59And it is.
2:59There it is.
3:00And by the way, if you look at that in the UI here,
3:02let's head into the services applet.
3:04Locate Docker in here.
3:06There it is, Docker engine.
3:07And if we take a peek at this, you'll
3:09see that it's just calling the daemon here
3:11with the run service flag.
3:13Again, this is what does all the heavy lifting.
3:15We just send commands through it with the Docker CLI.
3:19Now another fun test you can do to make
3:20sure all of these components installed properly
3:23is to run a container out of microsofts.net samples
3:27repository.
3:28Now we don't have anything on this machine
3:30at all, no images, nothing.
3:32In fact, we can verify that by running a Docker images,
3:34and we should see that we have nothing
3:36in our local repository.
3:37So by running this command, it's going
3:39to download the base operating system image, which
3:42in this case will be nano server,
3:44along with the application, and all of its requirements,
3:46and all the other images that lay on top of that base image
3:49for this container.
3:50And by the way, this container just
3:51has a really simple little app inside of it
3:54that will print out some Ascii art to the screen.
3:56Now I'm not going to run this inside of the ISE,
3:59because the output looks a little funky.
4:01So I'm actually going to copy this, and let's
4:02run this through the command prompt here.
4:05So I'll paste this in here and execute it.
4:08And this will take a little while to run,
4:09because the nano server base image is a couple hundred
4:12megabytes.
4:13And some of these other images are a little large as well,
4:15so I think the total size is a little over a gig.
4:18So I'll let this download and come back when it's done.
4:21We're almost there.
4:22It downloaded all of those layers.
4:23Now it's extracting them.
4:25One of the beautiful things about containers
4:27is since we've already gone through this process,
4:29they're all stored in our local repository.
4:32If Microsoft were to release an update to this application,
4:35and we attempted to run this container after that update
4:37took place, it wouldn't need to re download
4:39all these layers, just the ones that have changed.
4:42Now you'll see here as soon as this is done,
4:45it's going to spin up that container.
4:47The container will run its code, output this Ascii art,
4:50and then close down the container.
4:52And that's exactly what it just did.
4:54Now let's run this container again.
4:56Only this time, we'll use our command here in the ISE,
4:59and this time, it won't have to re download everything.
5:01It's just going to run that container, output
5:04its information, and closed down.
5:06Also, if we were to run a Docker images here
5:09to take a look at our local repository,
5:11we will see that image within.
5:13One more thing I want to mention here
5:15is updating Docker is a breeze.
5:17You can run a fine package against the Docker package
5:19in Microsoft's Docker repository to get
5:22the current version posted up there in that repository,
5:25and there it is.
5:26You can see where on the latest version.
5:27If we are not the latest version,
5:29and we wish to upgrade, we can just run an install package
5:31just like we did initially only with the update flag.
5:34And that will perform an update of the Docker binaries
5:37on this machine.
5:38And from there, you can fire up the Docker service
5:41and be on your way.
5:42In this CBT Nugget, we cover the process
5:44for standing up a Windows container
5:46host by installing support for containers in Windows
5:49and downloading and installing Docker.
5:51I hope this has been informative for you,
5:52and I'd like to thank you for viewing.
Configuring Docker Startup Options
0:00In this Nugget, we're going to look
0:01at how to configure startup options for the doctor daemon
0:04to ensure they persist across restarts,
0:06and look at some of the most common of these options.
0:09Here we are on our container host CN-NUG.
0:11Let's get right into the PowerShell ISE.
0:13The first thing I want to show you
0:14here is where you can find a list of all of these startup
0:17options.
0:18Now, Docker supports a massive list of startup options,
0:21but Windows only supports a small subset of them.
0:24And Microsoft, in their docs, has a page here
0:26that outlines what those options are.
0:29So I'm going to go ahead and fire up Edge here,
0:31which will take us right to that page.
0:33And if we scroll down a little bit,
0:35you'll see a section here on configuring
0:36Docker with a configuration file, which
0:39is the recommended approach.
0:40That way, these settings persist across service restarts.
0:45Now, you can configure these options
0:47on the fly against the Docker service,
0:49but, again, they will only stick around for as long
0:52as that service is running.
0:53They'll get reset back to their defaults
0:55when that services restarted.
0:56And that's why it is recommended to use a configuration
0:59file, which is what we're going to be doing here.
1:01Now, this is the relatively small list
1:04that Windows supports for startup options for Docker.
1:08You can see the complete list at this link here.
1:10Which, again, it is massive, but a lot of those
1:13do not apply to Windows.
1:14Now, some of the most common options
1:16that you'll be configuring after a Docker installation
1:19include things like the data route.
1:21We'll be configuring this one here shortly.
1:23This will change the default location, where our local image
1:26repository is on the system.
1:28The default is in the C drive.
1:30Another one is hosts.
1:32This will define the IP addresses and ports
1:34that containers will be listening on.
1:37You can also configure a log level here.
1:39Debug mode is in here as well.
1:40Where are you, debug?
1:41There it is, right above host.
1:43And then, also, group is another one.
1:45The default here is that communication will occur over
1:48named pipes when we want to interact with the Docker daemon
1:51through the CLI, and that means only local administrators will
1:55have the ability to do that.
1:57If you have a specific group that you want to give access
1:59to, you can give that group access here and define it
2:02within this configuration.
2:03So in this Nugget, we're going to configure group and data
2:06route.
2:06Those are two of the most common options
2:09you'll be configuring, again, out of the box with Docker.
2:11There are some other ones that you'll
2:13configure when you get into container management,
2:15and we'll look at those a little later on.
2:17Let's head back into the ISE.
2:19And the first thing I want to show you here
2:21is this Docker info command.
2:22This is short for Docker system info,
2:25and it'll give us some good system information
2:27here around our installation.
2:29We can see here our Docker root directory is at the default, C,
2:31ProgramData, docker.
2:32And if we scroll up a little bit here,
2:34we can see that we've executed two containers.
2:36We have one image.
2:38And as we scroll down here, we can also
2:39see some other useful information,
2:41like our default isolation level is process,
2:43which is Windows containers, as opposed to Hyper-V containers.
2:46Now, the next thing we're going to do here
2:48is essentially reset Docker by running
2:50a Docker system prune --all.
2:52This will remove that base image and give us
2:54a nice, fresh start.
2:55So we're going to run this, and this will just
2:57take a second to clear everything out.
2:59All right.
2:59That's done.
3:00And by the way, I had to do that here in the command
3:02prompt because you don't get prompted in the ISE,
3:05but that removed everything.
3:06And now, if we run a docker info again,
3:08we should see that everything has been reset.
3:11We no longer have any containers or images here within.
3:15And now we can move this--
3:16all of this-- to the new volume.
3:18Now, before we create this configuration file,
3:20let me show you where everything is on the file system.
3:23If we open up File, Explorer here and head into the C drive,
3:26into ProgramData, you will see a directory here called docker.
3:29This is where everything Docker is stored--
3:32our local repository, our images, and our configuration
3:36file, which you can find in the config directory.
3:38Notice there is no daemon.json file in here by default.
3:42So that's our next step.
3:43We need to create that file and then restart the service for it
3:47to pick up those changes.
3:48Let me also show you our destination is here.
3:50Over on the S volume, I created a directory called Docker,
3:54which is currently empty.
3:55So we're going to move everything over
3:56to this directory, on this volume.
3:59Let's do it.
3:59Back in the ISE, we're going to execute this command, which
4:02will send this string of text, or JSON defining our start
4:05up options, into a brand new daemon.json file inside
4:09of that config directory.
4:11So if we execute this, that'll create it.
4:13And now to pick up those changes, all we need to do
4:15is restart the Docker service.
4:16With that done, if we head back into the file system
4:19and into our Docker directory on the S volume, look at that.
4:23It moved everything over, and this is the new default
4:25location for everything Docker.
4:27We can verify that by running a docker info one more time,
4:32and we can now see our Docker root directory is over
4:34on the S volume.
4:36In this CBT Nugget, we covered how
4:37to configure Docker to startup options using a configuration
4:41file.
4:41I hope this has been informative for you,
4:43and I'd like to thank you for viewing.
Installing a Base Container Image
0:00Let's take a look at all of the base container images
0:02available to us here on Windows, and we'll
0:04go through the process of installing a base container
0:07image onto our container host.
0:09Here we are on CN-NUG, our container host,
0:11which currently contains no base container images.
0:14So we're going to fix that.
0:15Let's jump into the ISE.
0:17And where we can find these images
0:19are up in the Docker hub.
0:20So I'm going to fire up hub.docker.com inside of Edge,
0:24and this contains public and private repositories
0:26for all kinds of images.
0:27And vendors such as Microsoft have
0:29their own public repositories that we can use.
0:32I'm going to hit the Search bar here and type in Windows.
0:36In the search results here, I'm going
0:37to head into the Windows base OS images repository.
0:41This contains a reference in the description to featured repos.
0:44And these are the four repositories
0:46that contain the four container based images
0:49that we can use in Windows.
0:51Now these first two are by far the most popular.
0:53Our Server Core and Nano Server images.
0:56You'll use Server Core if you need access to the full data
0:58.NET framework.
1:00You'll use Nano Server if you can get away with .NET Core.
1:03And this is a much smaller image.
1:06The Nano Server image is a little over gig.
1:07The Server Core image is a little over nine gigs.
1:10These other two are for special use cases.
1:13IoT Core if you need to support IoT-based applications.
1:17And this Windows contains the full Windows stack
1:20and all dependencies built in.
1:22So if your application needs specific DLLs or access
1:26to GDI libraries, then you'll use this one.
1:28We're going to be using Nano Server.
1:30So let's head into this repo.
1:32You can see this is by far the most popular one--
1:35over 10 million pulls out of this repo.
1:38You can also get the command to pull the base image.
1:41This will pull the image with the latest tag.
1:45And if we scroll down here, you can see featured tags.
1:48So if you want to pull specific images or images for older
1:51versions, you can append the tag to the end
1:53of the command, which we'll do here in a little bit.
1:56Also if you scroll down to the bottom here,
1:58you'll get a listing of these images.
2:00And if you scroll even further, you
2:01can get a full listing of all the tags
2:03available for these base images, and there's quite a few here.
2:07It's actually a huge list of JSON.
2:09So I won't actually open that up,
2:11but I will show you how we can download
2:13a specific tagged image.
2:15Now let's head back into the PowerShell ISE,
2:17and let's execute that command here to pull the latest Nano
2:21Server image, and this is going to take about 10 or 15 minutes
2:24to install.
2:25So I'll let it run through until it's done.
2:29All right, with that all set, we now
2:31have a base image installed in our container host.
2:33Notice the last line of the output
2:35here that it automatically appended the latest tag to it,
2:38which gave us the latest Nano Server
2:40image out of that repository.
2:42Now we can also pull specific images based on their tag
2:45by appending the name of that tag
2:46to the name of the container image.
2:49So in this case, we're going to pull
2:51this version of Nano Server out of that repository,
2:54and it will live side by side with our other one
2:56in our local repository.
2:58One thing to be aware of here when pulling based container
3:01images is that the operating system
3:03version must be the same as your container host OS version.
3:08So if we were to run a winver here,
3:11we can see that we're running version 1609 build 14.393.
3:15So we wouldn't be able to pull, say, build 1803 or 1809.
3:18In fact, if we were to try this out here,
3:20I'll go 1803, which by the way, if we head back
3:23to the dock repository, here it is right here.
3:25This is a more recent image of Windows.
3:28So if we attempt to pull this, we'll
3:30get an error here just letting us know that our versions don't
3:33line up.
3:34And there it is-- our 14.393 host
3:36is incompatible with that 17.1.34.1803 image.
3:41So if you want to run newer base OS container images,
3:44you'll need to make sure that your hosts match.
3:46And if you want to support older OS container images,
3:49then you can use Hyper-V containers,
3:52which have an isolated kernel.
3:53They do not share the kernel with the host.
3:55All right, let's put this back to where we were, and let's
3:58run this to download this specific version of the 14.393
4:02base OS container image.
4:04All right, that's done, and it didn't take nearly as long
4:06as our initial poll because we already had some of the bits
4:09from Nano Server from that initial poll.
4:11So we can see one of those image layers already existed.
4:14Now if we want to take a peek at our local image repository,
4:17we can run a Docker images, and this should
4:19list both of those images.
4:21And check it out-- we can see our latest image is much newer
4:25and a little bit bigger--
4:26probably because more features were added in--
4:28and our older image is much older and slightly smaller.
4:32So now that we have these base images
4:33installed in our local repository.
4:35We can begin spinning up containers from them
4:37and then getting into them, installing our application,
4:40all of their dependencies, and support
4:42containerized workloads.
4:43One more thing I want to point out here
4:45is if you ever need help in Docker,
4:46you can use the help switch here,
4:48which will give us a lot of great help for all the commands
4:51and subcommands that it supports.
4:53We'll be using a few of these as we head
4:55through the next many Nuggets.
4:57In this CBT Nugget, we covered the four base container OS
5:00images available to us in Windows,
5:02as well as the differences between them,
5:03and we even installed a couple of Nano Server based OS images
5:08onto our container host.
5:10I hope this has been informative for you,
5:11and I'd like to thank you for viewing.
Creating Windows Server Containers
0:00Let's take a look at the many ways
0:01that we can create, run, and work with Windows Server
0:04containers.
0:05Here we are on the desktop of our container host, CN-NUG.
0:08Let's jump into the PowerShell ISE.
0:09Now, I just want to point out that running containers
0:12in the ISE oftentimes freezes it up.
0:14So we're going to be doing a lot of this
0:16through the PowerShell console, but I just
0:17wanted to point out that there is a script here,
0:19so when you get into our hands-on lab Nugget
0:21you have it for reference.
0:22So some of the things we'll be doing in this Nugget
0:24are looking at a couple of ways that we
0:26can run containers interactively as well as detached.
0:29We'll view running containers, stop and start
0:31containers, attached to containers, inspect containers,
0:35and then also remove them.
0:37All right, let's fire up the PowerShell console.
0:41So we'll launch this under an elevated session.
0:44And I'll get it into our screen here so we can see it.
0:47So let's begin here by just taking a look at the images
0:49in our local repository.
0:50We should have two of them, our latest nanoserver image
0:54and a versioned, tagged nanoserver image.
0:57So let's say that we wanted to fire up a container based
1:00on one of these images.
1:01Let's start here with an interactive container.
1:03We'll do a docker run -it --
1:06for interactive-- and then the name
1:08of the image that we want to create this container of,
1:11which is right here, mcr.microsoft.co
1:12m/windows/nanoserver.
1:17And we're going to launch right into the command shell.
1:21And check it out!
1:22We are inside of that container.
1:23Much faster than firing up a VM from scratch!
1:26And now we can do things inside of here,
1:28like look at the host name.
1:29There it is, which is actually the container ID.
1:32We can run an ipconfig to look at the IP configuration,
1:35and it is connected to the default NAT network associated
1:38with containers.
1:39We'll look more at that when we get into container networking.
1:41Let's run a ping command against our default gateway.
1:45Sure enough, we can hit it.
1:47Let's ping outside.
1:48We'll ping Google's DNS servers here, 8.8.8.8.
1:51And look at that, we can hit it from inside our container.
1:54Now if we wanted to get out of this container
1:56there's a couple of things we could do.
1:57If we exit out of this container,
1:59the container will stop and it'll be done.
2:01But we can also hit Control-PQ to just exit the container
2:05and leave it running.
2:06Now let me show you the effects of this.
2:07Let's start by exiting.
2:09All right, we're outside of that container.
2:11If we want to docker ps, which will show us all of the running
2:14containers, this isn't going to return everything,
2:16because we exited out of that and the container spun down.
2:18If we recall our last command and do a -a
2:21on the end of that for all, this will show us
2:23all containers, stopped and started on the system.
2:25We can see that it exited there 13 seconds ago.
2:28Now I'm going to recall a bunch of commands
2:30ago here so we can rerun our container, once
2:32again, in interactive mode.
2:35All right, we're inside.
2:36And this time I'm going to do a Control-PQ, which will not
2:39spin down the container.
2:40That container should still be running.
2:41And if we run a docker ps here without the a switch
2:44we should see that container is running
2:46and its status is up for 11 seconds.
2:48This is also a brand new container so it got a new name.
2:51Notice the randomly generated name here, confident_ramanujan.
2:55The random names that it assigns that
2:57are sometimes just fantastic.
2:59But now if we run a docker ps with the a switch
3:01we should see two containers, one that is stopped
3:04and one that is currently running.
3:05And by the way, when you fire up new containers,
3:07you can use the name parameter to give it
3:09your own user defined name if you didn't want one
3:12of these random ones generated.
3:13And then for managing and working with containers,
3:16you can either use the ID or the name.
3:19In fact, let's stop that container
3:21that's currently running here.
3:22If we do a docker stop, all we need to do here
3:25is enter in either the ID or the name.
3:28And you only need to enter in enough to make it unique.
3:31So, for example here, all we would need
3:33is 72, part of the ID here, to stop this container.
3:37And it's done.
3:37And now if we run a docker ps one more time here
3:40we shouldn't see any containers currently running.
3:42Now we can also use that ID to start containers.
3:44Let's say we wanted to restart one of these containers.
3:46How about the first one that we've fired up, f7 there.
3:49We can do a docker start f7 and that will spin up
3:52that container once again.
3:54Now a docker ps should show us that container is running.
3:58And we can see that vigorous_newman ID
4:00f7 is back up.
4:02Now what if we wanted to get back inside of that container
4:06to do some work?
4:07This is where we can attach to them using docker exec.
4:10Here we can do another interactive session.
4:13All we need here is the name or ID, so we'll do an f7,
4:16and then we need to give it something
4:18to do so we'll launch right into the command shell.
4:21And look at that, we're back inside of that container.
4:24Now once again I'm going to Control-PQ out of this
4:26so we leave that container running.
4:28Here we go.
4:29And now it should still be running here,
4:31so if we do a docker ps, there it is.
4:34Another handy command here is docker inspect.
4:37Same thing here, pass in part of the ID or the name and this
4:40will show us all kinds of great container details.
4:43So we can see a lot of that same information
4:45that we were just looking at on the inside,
4:47only from the outside here.
4:49So we see it's network configuration,
4:50see it's connected to the default NAT network there.
4:53And as we scroll up, we get all kinds of great information.
4:55A lot of stuff here sent back as JSON about this container.
5:00Now these are Windows Server containers.
5:01And let's take a look at the effects of a Windows Server
5:04container.
5:04Remember, the only difference between a Windows Server
5:06container and a Hyper-V container
5:08is the isolation of the kernel.
5:10It's shared here with Windows Server containers
5:12and completely isolated with Hyper-V containers.
5:14And we can actually see that in action.
5:17If we head into Task Manager here, head down to all details,
5:20and then details.
5:21And we're going to add a new column in here.
5:22So we'll right click on the column headers
5:24and choose Select columns.
5:25And from here we're looking for job object ID.
5:28All right, so here it is right here.
5:30Now I can already tell you that the container that's
5:32currently running is 112.
5:34But the point here is that we can actually
5:36see these on the outside on the container host.
5:39Let's spin up a few more containers here.
5:41And this time we're going to do it in detached mode.
5:43So we'll do docker run -d the name of our image,
5:47mcr.microsoft.co m/windows/nanoserver.
5:52And by the way, if you wanted to run
5:54an old version, or a tagged version of an image,
5:57then you would just add a colon and the name of that tag.
6:00But here we're going to run it like so.
6:01We're also going to give it a workload
6:03to run here so it doesn't just spin down automatically.
6:05So we'll do a ping -t here so it just runs continuously
6:08and we'll ping our default gateway.
6:10There we go.
6:11And you'll notice as soon as I hit enter there,
6:14I saw a Task Manager do something in the background,
6:16and it's spinning up another job here.
6:19And we should see a ping command show up once this is all done.
6:22Oh, it is spun up here.
6:23There it is, right there.
6:24Check it out.
6:25Ping 140.
6:26So we can see here, if we start by our job ID,
6:28140 is that new container.
6:30112 is that other container.
6:32The difference here is we've got a ping command running
6:33in this new one.
6:34Let's spin up another container.
6:36I'll recall my last command and do it again.
6:38And you can now kind of see the power and scale of containers.
6:41Imagine if this was a web service or a website.
6:45We could spin up many containers, put load
6:46balancing on top of them, and that is scale with containers.
6:50Now that we ran another container
6:51we should see another process in here.
6:53Look at that, job ID 152 is also running a ping command.
6:57So this is the effect of Windows Server containers here
6:59is that we can see all of these processes from the host
7:02because they all share that host kernel.
7:05Now let's shut all of these containers down
7:07and remove them.
7:08Let's start here with the docker ps
7:09to take a look at all of our running containers.
7:11We should have three of them, and we do.
7:14Now we could attempt to remove these containers
7:17and pass in all of the IDs, but you can't actually
7:19remove a running container, although you can
7:21use the F switch to force it.
7:23But let's do this step by step here.
7:24Let's start by doing a docker stop.
7:26We'll do 1c the first container, b2 for the second container,
7:30and f7 for the third one.
7:32And that should stop all three of those.
7:34And you could see Task Manager spin down
7:37all of those containers.
7:39Now if we do a docker ps -a, we'll
7:43see all of those containers that we started and then stopped.
7:47We've got four of them in here.
7:48And now we could just do a docker rm,
7:50and again pass in all the IDs.
7:52So there's a 1c, a b2, a 72, and an f7.
7:56And that will remove all of those containers
7:58from the system, and now if we do a docker ps -a,
8:02no more containers started or stopped.
8:04In this CBT Nugget, we looked at how to create Windows Server
8:07containers from docker images and how to manage them
8:10through the docker client.
8:11I hope this has been informative for you,
8:13and I'd like to thank you for viewing.
Creating Hyper-V Containers
0:00In this Nugget, we're going to look
0:01at how to create Hyper-V containers
0:03and see how they differ from Windows containers.
0:06Here we are once again on our container host CN-NUG.
0:09Let's start here by jumping into the ISE.
0:11Again here, the ISE will freeze up
0:14if we attempt to run containers through it.
0:16So I just want to point this out as a reference
0:18because you'll be using this in our hands
0:19on lab Nugget coming up immediately after this one.
0:22So we're going to do all of this here in the standard PowerShell
0:25console.
0:26So let's begin here by firing up a standard Windows container.
0:29We'll do a Docker run.
0:31We'll run this in detached mode.
0:32Let's also give it a name here.
0:34We'll name this CN1-NUG.
0:36Then we need to provide our image here.
0:38That's going to be mcr.microsoft.co
0:40m/windows/nanoserver.
0:44And then we'll also give it a little workload to run here.
0:47How about the ping command running infinitely
0:50against our default gateway 192.168.1.1?
0:53So that's going to fire up a standard Windows container.
0:56All right, so with that done, let's
0:57fire up another container-- only this one is going
1:00to be a Hyper-V container.
1:02So I'm just going to recall my last command here,
1:04and we'll call this one CN2-NUG.
1:07And the only other thing we need to do here is specify
1:09our isolation level, and we do that by using the isolation
1:13flag and setting that equal to Hyper-V--
1:16so same container, just with V isolation.
1:20Now let's verify both of those containers
1:22are running by running a Docker ps, and there they are--
1:25CN1-NUG and CN2-NUG.
1:27Now it's difficult to see with the default output
1:29which one is the Hyper-V container
1:32and which one is the Windows Server container.
1:34And that's, again, where the inspect command
1:35comes into play, so we can do a Docker inspect.
1:38Let's look at CN1-NUG first here.
1:40And now if we look into the details here,
1:43I'm going to scroll all the way up
1:44until we see host config because underneath host config,
1:48you will see isolation.
1:49And we can see its process here for CN1-NUG, our Windows Server
1:54container.
1:55Now the inspect command actually has a format switch on.
1:57In fact, if we run a Docker inspect using help,
2:01we can see the f switch will allow
2:03us to pull out specific properties from all that JSON.
2:08So for example here, we can do a docker inspect/f.
2:12And then in parentheses here, we're
2:14going to navigate through the JSON.
2:16So pass the route and inside of the second level
2:19is dot host config.
2:22And the property we're looking at within there
2:24is called isolation.
2:25We can close those brackets, and now we
2:27need to specify our machine.
2:28We'll go CN2-NUG this time, and this
2:30should return the isolation level here,
2:33which is Hyper-V. So that's cool.
2:36We can even recall that last command and change CN2-NUG
2:39to CN1-NUG, and they should say process, which
2:41is a Windows Server container.
2:43Now another thing we're going to look at here
2:44is Task Manager because if you remember in our previous Nugget
2:47with Windows Server containers, we could actually
2:49see all the processes that were running
2:51inside of that container from outside here on the host.
2:54Well, not so much with Hyper-V containers since they
2:57have their own isolated kernel.
2:59If we head into the Task Manager here, hit more details,
3:02head over the details, let's add that job ID in here.
3:05We'll select columns.
3:07We'll add job object ID, and we can sort by it.
3:11And we should be able to identify here
3:13that our Windows Server container is
3:14job object ID number 52, and then our Hyper-V container
3:19is right here-- job object ID number 80.
3:22Notice here that there's no other 80 within this list as I
3:25have it sorted here descending, meaning we cannot see all
3:29the service host, the ping command,
3:31nothing inside of that container since it's a Hyper-V container
3:34is exposed here to the host.
3:36So the bottom line here is that Hyper-V containers provide us
3:39with the ultimate in isolation because they
3:41have their own dedicated kernel In this CBT Nugget,
3:44we looked at how to create Hyper-V containers to provide
3:47our containerized workloads with the best
3:49possible level of isolation.
3:51I hope this has been informative for you,
3:53and I'd like to thank you for viewing.
Deploying Windows Containers Lab
0:00Are you ready to get hands-on with Windows containers?
0:03This hands-on lab will give you the opportunity
0:05to do just that.
0:06In this Nugget, we're going to challenge you
0:07with some common tasks around standing up a container host.
0:11This lab consists of just a couple of machines
0:13and you'll be spending all of your time
0:15here on CN-NUG, which will play the role of our container host.
0:19And that's your very first task here,
0:20is to install Docker and container support.
0:23Keep in mind, installing Docker through PowerShell
0:26will also add the container feature in Windows.
0:29So we can do this all in one shot through PowerShell.
0:32And I'll show you where those scripts are when
0:34we get into the virtual lab.
0:35Once that's all set, your next task
0:37here will be to configure Docker startup options using
0:40a configuration file.
0:41The big option you'll want to set
0:43is the data root directory the name of the option
0:45is data dash route.
0:47And what you want to do there is move it from the default
0:50installation, which is on the C volume over to the S volume,
0:54where I created a directory that is empty called Docker.
0:57So configure the startup option to point to this directory,
1:00and then restart the service.
1:02And that will move Docker's repository and everything over
1:04to that S volume.
1:06Another option you can configure is the group option.
1:08There is a DevOps group, an active directory,
1:11so you can reference that group to give them the ability
1:13to run CLI commands on our container host.
1:16Moving on, your next task is to install some base OS container
1:19images.
1:20You can use Microsoft's public Docker hub repository
1:23to download a nanoserver base OS image,
1:26and you can download multiple OS images based on their tag
1:29if you want to reference a specific version.
1:31But download and install those onto our container host.
1:35Next up is where the fun begins.
1:37Create containers!
1:38Create Windows Server containers based on those OS images,
1:41and also create Hyper-V containers
1:42based on those OS images, and then use
1:44Task Manager to view the differences between them.
1:47All right, let's jump into the virtual lab
1:49that you'll be working in, so I can give you a quick tour
1:52of where things are.
1:53Here we are on CN-NUG.
1:54This is the machine that you'll have access to,
1:56and that you'll be transforming into a container host.
1:59About the only thing you need to know
2:00for this lab is all of these scripts reside in the Nugget
2:03Lab directory.
2:04And also use these as a reference.
2:06I would actually run the code within these scripts,
2:09either through a PowerShell session
2:11or through the command shell.
2:13Be careful running these inside of the ISE,
2:15because oftentimes they'll freeze it up.
2:17One more thing I want to show you here,
2:19if we head down to the S volume, is the Docker directory.
2:22Notice here that it's empty.
2:24So when you configure your Docker start up options
2:26you'll create a daemon.json file,
2:28plant that in the config directory on the C drive,
2:31which, by the way, the default installation
2:33is inside a program data.
2:34There will be a Docker directory inside of here
2:37when you install Docker.
2:38So you'll create a daemon.json file, place it in the config
2:41directory, restart the service, and that will move everything
2:44over to that S volume.
2:46And that's about it!
2:47As always, good luck, and if you need any assistance,
2:49refer to the container Nuggets in this section.
2:52In this CBT Nugget, we provided you with access
2:54to our virtual lab environment so you
2:56can get hands-on with deploying Windows containers.
2:59I hope this has been informative for you,
3:01and I'd like to thank you for viewing.
Managing Windows Containers using Docker
0:00We're going to have some fun in this Nugget
0:02by looking at some common management tasks
0:03around containers and images.
0:05Let's do it.
0:06From the desktop of our container host CN-NUG.
0:09I'm going to jump right into the Integrated Scripting
0:11Environment.
0:12Let's start here by taking a look at images and image
0:14management.
0:15The first thing I'm going to do here in the ISE
0:17is run Docker images.
0:19This will show us our images.
0:20We've done this many times before.
0:22But what I wanted to point out here
0:23is I downloaded the Server Core base operating system
0:26onto our container hosts.
0:27And that's what we're going to be working
0:28with here in this Nugget.
0:30Now let's say that we wanted to rename these images
0:32or create new images based on these images with a new name.
0:36This is where the Docker tag command comes into play.
0:38Here we're going to rename these because we want to type
0:40all that out every time.
0:41So rename mcr.microsoft.co m/windows/servercore
0:45to just microsoft/servercore and we'll do the same thing here
0:49for Nano Server.
0:50So we'll run this, and that will change both of those.
0:53It won't change them.
0:54It'll actually just make new ones
0:55because if we run Docker images again, now
0:57we'll have four images inside of our local repository.
1:00So here's where if we want to get rid of these older images,
1:03we can use the Docker RMI, Remove Image command.
1:06So we'll get rid of these longer image
1:08names here by executing this command.
1:10And if we run docker images one more time here,
1:13we should just have these two images--
1:15pretty simple stuff there.
1:16Now the next thing we're going to do
1:17is a little more exciting.
1:19What we're going to do is run a container in interactive mode,
1:22install IIS into it, and then create a new image
1:26using Docker commit.
1:27And we'll do some other things along the way here.
1:29We're going to take this the rest of the way
1:31though in the PowerShell console because, again, spinning up
1:34containers in the ISE just usually doesn't work very well.
1:37So if we head into the PowerShell console here.
1:39The first thing we're going to need to do
1:41is spin up a new container based on that image.
1:43So we'll do a Docker run.
1:44This will be an interactive session.
1:46Let's also give it the name here.
1:47How about CN-dev?
1:49This will be our development container and then
1:51the name of the image, which was microsoft/servercore.
1:55And we'll get into a PowerShell session within.
1:59A few minutes later and we are inside of that container,
2:02working in our base OS Server Core image.
2:05So let's install IIS here.
2:06We'll do an install Windows feature web server
2:10and give this a second to go.
2:13And there it is-- success.
2:15We've installed IIS inside of our container.
2:18Now our next step is to create a new image
2:20based on this container.
2:22What we're going to do is just exit out of the container here.
2:24If we were to do a control pq, that
2:26would leave the container running,
2:27and then you would need to stop it manually
2:29with the Docker stop before you can create an image.
2:31So I'm just going to exit out of that, which
2:33will spin down the container.
2:34And we can verify that here with the Docker ps.
2:37We can see that there should be no containers running--
2:39perfect.
2:40But that container is still out there
2:41because if we were to add a slash a on the end of that,
2:43it's there, and that's good because we're
2:45going to need to get back into that in a little bit
2:46to do some more things to it.
2:48Plus we want to create our own image
2:50based on the current state of that container.
2:52And we do that using Docker commit.
2:54So if we run a Docker commit, specify our container name
2:57here, and then our image name--
2:59let's call this Nuggetlab/iis--
3:03that's all there is to it.
3:05This will take just a second to create that image
3:07and add it to our local repository.
3:09Now with that done, we can run a Docker images once again here.
3:13And we should now see that new image in our repository.
3:16And there it is right there.
3:17And we know that this image is the Server Core image plus IIS
3:22that we just installed on it.
3:23Now let's say that we wanted to create a another image-- only
3:26an image that contains Server Core, IIS, plus our custom
3:31website.
3:32Well, if we head into the Nugget Lab directory on this machine,
3:35I have a directory in here called mysite,
3:37which contains an HTML page and just an image--
3:40just basically a static page here.
3:42So what we're going to do is copy this site
3:44into that container-- our dev container--
3:47and then create another new image
3:49that is tagged with mysite.
3:51So we can do Nuggetlab/iis witg the tag of mysite.
3:54So the first thing we need to do here
3:55is fire up our development container.
3:58So we'll do a Docker start, not just start--
4:00Docker start cn-dev to fire that container back up.
4:05So it's kind of our development workspace here.
4:07We could easily fire up a new container
4:08based on that image we just created,
4:10and it'll have the same effect.
4:11But since we already have a container out there ready
4:14to go, we'll just continue using that as our workspace.
4:16So that container has now started.
4:18Our next step is to use as a Docker cp command
4:21to copy that mysite directory into the container.
4:25First thing I'm to do here is just
4:26switch our directory-- our working directory here--
4:29to Nugget Lab.
4:31And now we're going to run a Docker cp.
4:34We'll specify our source here as my site,
4:37and our destination will be the container colon
4:41and then the path to the destination, which
4:43is going to be inetpub wwwroot just like so,
4:49except that I have the wrong container name, not cpdev.
4:52That would be cndev.
4:54Here we go.
4:54This time, it should work, and it did.
4:57Now in order to create a new image
4:58based on the state of that container,
5:00once again, we need to spin that container down.
5:02So here we'll do a Docker stop cn-dev.
5:07And one more time here, we'll do a Docker commit, specify
5:10our container name, cndev, and our image name,
5:13which is going to be Nugget lab IIS,
5:15and then we'll do a colon to tag this as mysite.
5:19All right, with that done, let me clear the screen
5:21here of all the clutter.
5:23And now if we run a Docker images,
5:25we should see both of our images.
5:27There's our image with just IIS installed,
5:29and here's our tagged Image that also contains our site.
5:32Now comes the fun part I promised you.
5:34We're going to fire up a new container based
5:36on this image with the mysite tag
5:38and see if we could browse to it.
5:40So here we're going to do a Docker run.
5:42This will be an interactive session.
5:44We're going to map port 80 of the host
5:46to port 80% of the container-- more on that here when we
5:48get into container networking.
5:49I forget the dash there-- there we go.
5:51And then we're also going to name this here.
5:53Let's give the name Web-NUG, and then all we need to do here is
5:55pass in our image, which is going to be a Nugget
5:57lab/IIS:mysite, and we'll launch into a PowerShell session.
6:04There we go.
6:04All right, we're in the container
6:06one thing we're going to need here
6:07is the IP address of the container.
6:09There it is.
6:09We'll run an IP config.
6:10I'm just going to copy this here, copy it, and now let's
6:13bring up Internet Explorer.
6:15And the reason we need to browse to the IP
6:17address of the container is because we
6:19are on the container host.
6:20So if we were outside of the container host, which we'll
6:23do here in a second, we should be
6:24able to browse to the IP of the host or the DNS name.
6:28There is NAt on this machine, Network Address Translation.
6:31That is the default network, and everything flows through.
6:33So that's why we need to use the IP address of the container
6:36when we're directly on our container host--
6:38again, more on that when we get into container networking.
6:40But you can see here this is the default site associated
6:42with IIS.
6:43Let's try to navigate to the site
6:44that we copied into there, which is mysite default.html.
6:49And look at that-- there it is--
6:51served up from inside of that container.
6:54Now let's head over to our domain controller
6:55and see if we can hit this website from outside
6:58of our container host.
6:59So here we are on DC-NUG.
7:01I'm going to fire up Edge here.
7:02And let's start by browsing right over using the DNS
7:05name to CN-NUG.
7:06This should display the default IIS website.
7:08And now let's see if we can hit the site that we
7:10copied over there, mysite default.html.
7:14And voila, it works.
7:16That site was served up through that container
7:19living on our container host--
7:21pretty cool stuff.
7:22Containers are just like mini virtual machines.
7:24We spin them up, install stuff on them,
7:26spin them down, and snapshot the image.
7:29In this CBT Nugget, we looked at some common management
7:32tasks around containers and images using the Docker client.
7:35I hope this has been informative for you,
7:37and I'd like to thank you for viewing.
Creating New Container Images using Dockerfile
0:00We saw in our previous Nugget how
0:02creating container images using the Docker
0:04commit command is quite a bit of manual labor.
0:07Well, in this Nugget, we're going
0:08to take a look at how to use a Docker file
0:11and the Docker build command to automate the process
0:14of building container images.
0:16Let's take a look.
0:17Here we are on our container host CN-NUG.
0:19Let's jump right into the PowerShell ISE
0:21where I have a couple of files opened up here.
0:23One is a Docker file, and the other
0:25is just a PowerShell script containing
0:27a bunch of Docker commands.
0:28If we look at this Docker file, really all this
0:31is a set of instructions for building an image-- a great way
0:34to automate the process.
0:36So a common workflow is to begin by spinning up a container
0:39from your base OS image.
0:41Then configure the environment, get your work load on it,
0:44and all the while documenting the commands that got you
0:47to that point, once you've tested everything
0:49and have it exactly how you want it,
0:51you can then stuff all those commands inside of a Docker
0:53file.
0:54And now you have a repeatable build process for those images.
0:57Now a Docker file itself is actually pretty straightforward
1:00to use.
1:00There's only a handful of instructions
1:03that we can add inside of here.
1:04You'll always start with a from.
1:06This is how we reference the base image that the new build
1:10image will be based on.
1:11We can also add in metadata here.
1:13Here we're adding a key value pair of maintainer
1:16equals this individual.
1:17There used to be a maintainer instruction,
1:19but that's been deprecated.
1:21And now we have the general label instruction,
1:23which allows us to add all kinds of metadata
1:25into our Docker files.
1:27Next up, we have the run instruction, which
1:28allows us to run commands.
1:30Here we're going to execute powershell.exe and pass
1:32the command install Windows feature
1:34to install IIS into the image.
1:36We're also going use the copy command here
1:38to copy the contents of the My Site directory
1:41to the WW root directory inside of the image.
1:44And finally, here we can use the command instruction
1:46to fire a PowerShell whenever a container is
1:49ran based on this image.
1:51There's a handful of other instructions as well. ,
1:53I'll give you the link to the documentation if you feel like
1:56exploring that.
1:57Now that we have a Docker file created,
1:59we can run Docker command-- specifically the Docker build
2:01command--
2:02to run that Docker file to automatically build the image.
2:06Let's start here by running a Docker images, just
2:08to take a peek at what we have in our repository.
2:10And you'll see here that we just have a couple of images
2:13within--
2:13there we go.
2:14Both of our base OS container images and our Docker file
2:17is referencing the first one here, Server Core.
2:20So now we can use the Docker build command
2:22to run the build process to generate an image based
2:26on a Docker file.
2:27The t flag here is really just the name flag.
2:30It stands for tag, but it allows us to provide a user
2:33defined name and optionally a tag,
2:35which we are providing here for this image.
2:37And the final parameter here is the path
2:39to your Docker file, which lives in the root of our Nugget lab
2:42directory, which is why we just put a dot there referencing
2:45that it lives inside of that directory.
2:47So if we execute this, it's going to step through
2:50and output each one of those steps
2:52as it goes to build this image.
2:55So I got bit by the ISE here.
2:57It froze right after it installed IIS.
3:00So I actually had that the Stop button and then re-execute
3:03this command inside of the PowerShell
3:05console-- so a good lesson here as
3:06to why we should stick to either the PowerShell
3:09console or the legacy command line shell
3:11for running Docker commands because it froze right
3:15after IIS.
3:16But thankfully, everything is cached here in Docker.
3:19So when I reran this command, it picked up right
3:21where it left off here and used the cache.
3:23It didn't need to reinstall IIS, picked up here
3:25with the copy instruction and the command instruction.
3:28And now we have our image.
3:29In fact, we can take a peek at this if we run Docker images.
3:32We should have our new build image ready to go
3:35and there it is.
3:37Let's finish this up by creating a container from that new image
3:40and testing it out.
3:42I'm going to copy this command here,
3:43which is just our typical Docker run command.
3:46We'll head into an interactive session,
3:48map port 80 of the container to the host.
3:50We'll give it a name.
3:51And notice here we're referencing that image.
3:53So back into the PowerShell console here,
3:55I'll just paste that in here and hit execute.
3:58All right, we're inside of that container.
4:00Now we need the internal IP of that container.
4:02We can do that on the inside with an IP config
4:04or on the outside here by doing a Docker inspect,
4:07specifying our container name web NUG.
4:10There is the IP address right there.
4:13So we'll copy this, fire up a browser,
4:17and we'll paste that IP in there.
4:18That should get us to the default website hosted
4:21in that container for IIS.
4:22There it is.
4:23And if we just add default.html to the end of this,
4:26that should be our customer site--
4:28awesome.
4:29In this CBT Nugget, we saw how to automate
4:31the process of building container images
4:34by using a Docker file.
4:35I hope this has been informative for you,
4:37and I'd like to thank you for viewing.
Managing Container Networking
0:00Container networking works very much like Hyper-V
0:02and virtual machine networking.
0:04Our containers come equipped with a virtual NIC,
0:06and container networks are essentially virtual switches.
0:09So in this Nugget, we're going to look at some container
0:12networking management tasks.
0:13We'll look at how to create our own custom networks
0:15and hook our containers up to those networks.
0:18Here we are in our container host,
0:19Hyper-V. Now the first thing I want to point out
0:22is that when you install Docker, a container network is created
0:25by default. And it is a NAT network.
0:28Now we can actually see the effects of this.
0:30If we were to look at the network connections
0:32here on this container host, you'll
0:33notice here that there's essentially
0:35a virtual switch automatically created called V-Ethernet.
0:39HNS here stands for Host Networking Service.
0:42And this is essentially an internal virtual switch.
0:45And the reason our containers can get outside
0:48is due to NAT, Network Address Translation.
0:51Let's jump into the PowerShell see here and take a look
0:53at how to control and work with and even
0:55create our own custom networks here using the Docker CLI.
0:58Let's start here by running a Docker network ls.
1:01This will show us all of the container
1:03networks on the system, and there's really only one here--
1:06that default NAT network.
1:08We can further drill into the details of this network
1:10by running a Docker network inspect,
1:12passing in the name of that network.
1:14This will show us all kinds of great details here.
1:16We can see if any containers are attached to it.
1:19We currently have no containers running.
1:21That's why this containers block is empty.
1:23If we scroll up, we can see the address space and the gateway
1:27here, and we can also see the driver that is used.
1:29This is essentially the mode.
1:31And we have four modes here that we can work
1:33with in Windows containers.
1:35In fact, let's cover those four types of networks real quick
1:38here.
1:38I'll do this in the PowerShell console.
1:40And by the way, there are a handful of PowerShell commands
1:42also for working with containers and container networking.
1:46Let's do a get container network.
1:49This is going to show us that one NAT
1:50network and a lot of the same information
1:52there we saw inside of Docker.
1:53But what I really want to show you here
1:55is help on new container network.
1:58Notice the mode parameter here has four options.
2:02These options determine the type of container network it is.
2:04NAT which is again here the default when you install Docker
2:07is Network Address Translation.
2:09This means our containers, when going outside,
2:11assume the IP address of the host.
2:13This creates essentially an internal virtual switch
2:16that they are connected to.
2:18The downside with NAT, of course,
2:19is we need to use port forwarding/port
2:21mapping in order to route traffic to our containers.
2:26And the real downside there is that it's a one to one thing.
2:29So you can only have one container attached or mapped
2:32to one port.
2:33The next one here transparent is by far the most popular kind
2:36of container network because it allows our containers
2:39to get onto the physical network very
2:41much like our VM is attached to an external virtual switch.
2:45Our containers can receive IP addresses automatically
2:47from a DHCP server on the network,
2:49and we can also statically assign them.
2:51Together, NAT and transparent make up
2:5499% of the container networks you'll see out there
2:57in the wild.
2:58These next two L2 bridge and L2 tunnel
3:00are primarily used for private and public cloud scenarios
3:04L2 bridge will force your containers
3:05to use the same network as your container host.
3:08An L2 tunnel is specifically used with Microsoft's cloud
3:11stack.
3:11Now while we're in the console here,
3:13let's remove this default network,
3:16and then we'll let Docker recreate it--
3:17only we'll specify our own custom address space here.
3:21So we're going to do a get container network,
3:24and then we'll pipe this over to remove container network, just
3:28like so.
3:29We'll choose Yes, and now we can head back into the ISE.
3:33Here we can use the fixed-cider startup option,
3:37specifying our own custom address space,
3:39and we'll store that inside of a brand new daemon.json file
3:42stored in Docker's configuration directory.
3:44There is, by the way, another option called bridge,
3:47and you can set that equal to none
3:48if you didn't want the default NAT network created
3:51for you automatically.
3:52But let's go ahead and run this to create their file,
3:54and then we can restart the Docker service to pick up
3:57those changes.
3:58Now if we rerun a Docker network inspect,
4:01we should see our own custom address space within
4:03and look at that--
4:0410.0.0/24.
4:07Now we can fire up a Docker container and verify that it
4:10will receive an IP from the 10.0.0/24 network.
4:14So we'll run this container back inside of here.
4:16And notice here that we're using import mapping here to map port
4:2080 of the host to port 80 of the container.
4:23The first block is your source.
4:24The second block is your destination.
4:26And if 80 was already in use on your host,
4:28you could do something like this--
4:3080.80 of the host to 80.80 of the container.
4:33And you can, by the way, specify this more than once,
4:36so we could do another P parameter here.
4:38And say, we wanted to map 443 of the host
4:40to 443 of the container.
4:42We could do something like that.
4:44All right, we are inside of the container.
4:45I'm going to run an IP config just so we can verify here
4:49that it did indeed receive an IP from that custom address space
4:52that we defined.
4:53Let's also verify that NAT is still working here.
4:55Let's ping our default gateway.
4:58That looks great, and let's see if we can get outside and hit
5:01Google's DNS servers.
5:03Indeed, we can.
5:04All right, I'm going to exit out of this container, which
5:06will spin it down.
5:08And let's take a look at transparent networks.
5:10The first thing I want to show you
5:11here is just a couple of help commands.
5:13Docker network help will show us those top level network
5:16commands that we can work with.
5:17So we've already looked at Docker network LS and Docker
5:20network inspect.
5:22We can also use connect and disconnect to attach and remove
5:24containers from networks.
5:26And you could also use the create command
5:27to create a network, which is what we're
5:28going to look at next here.
5:30Let's also take a look at the help for Docker network create.
5:33The big parameter within here is D, driver.
5:36Driver is the equivalent of mode that we
5:38looked at in PowerShell.
5:39And if we want to create a transparent network,
5:41we're going to set driver equal to transparent.
5:44Couple other things I want to point out here
5:46is if you want to assign static IPs to your containers,
5:51then you will need to specify the subnet and the gateway.
5:55And then when we spin up our container,
5:57we can attach an IP to it from the outside
5:58here when we're running it, or of course, you
6:00can statically assign them on the inside as well.
6:03If we had a DHCP server on the network,
6:05we would not need to provide any of that information.
6:07But since we don't have one in our lab environment here,
6:10we are going to provide that, so we can statically assign
6:13our containers with an IP.
6:15So let's create this transparent container network here.
6:19Again, the D switch is set to transparent.
6:20We're defining our subnet and gateway,
6:22and we're giving it the name transnet.
6:25All right, that's done, and we can
6:26see the effects of that on our host, by the way--
6:28check it out.
6:29We have a new virtual switch that is essentially
6:32acting as an external switch.
6:35Now let's fire up a container on that network.
6:38Notice here that we're setting the network
6:40equal to transnet to place this container onto that network,
6:43and we're also going to statically
6:45assign it an IP address.
6:46So I'm going to copy this take it into the PowerShell console,
6:50paste it in, and run it.
6:52So inside of the container, let's run an IP config
6:54to verify all that IP information-- looks good.
6:57And this container is just like another host
7:00on our physical network.
7:01In fact, let's see if we can ping our container host here,
7:03CN-NUG.
7:04We can.
7:05Let's even see if we can ping our domain controller, DC-NUG.
7:09Notice here we're using DNS, and it's
7:11resolving to their IPv6 addresses successfully.
7:15So we can easily spin up more containers,
7:16attach them to this network.
7:18They'll all be able to talk to each other along with anything
7:20else on the physical network.
7:21In this CBT Nugget, we covered container networking management
7:25and even how to create your own custom container networks
7:28and attach containers to them.
7:29I hope this has been informative for you,
7:31and I'd like to thank you for viewing.
Managing Container Data Volumes
0:00Container data volumes give us a couple
0:02of ways to share data between our hosts and our containers
0:04and between our containers themselves.
0:07Let's take a look at how they work.
0:09Let's begin by looking at how to map a directory on our host
0:12directly into a container.
0:14Here on our container host, I've got a directory inside
0:16of another lab directory called mydata that
0:18contains a couple of files.
0:20Now what we're going to do is fire up a container
0:22and use the v parameter to map this directory into whatever
0:26directory we would like within the container.
0:28So in the PowerShell console here,
0:30we're going to do a Docker run.
0:31We'll run this as an interactive session.
0:34We're going to use the v parameter here and specify
0:37first our source directory here on the host, which
0:39is C colon backslash nuggetlabs backslash mydata.
0:43Then we add a colon.
0:44And now we specify our destination inside
0:47of the container, and this can be anything.
0:49I'll just map this to a directory called data
0:52within the container.
0:53Now all we need to do is specify our container image.
0:55We'll do Microsoft/nanoserver and we'll launch right
1:00into a PowerShell session.
1:02So inside of the container, if we do an ls or dir,
1:05we should now see a data directory.
1:08And if we look inside of there, we
1:10should see those files available to us.
1:12We could also create a file here,
1:14and we'll see it out on the host.
1:15Let's do a new item.
1:17We'll specify our type here as file,
1:19and we'll specify the path here.
1:22And it's C colon backslash data backslash new file.txt.
1:27And we'll just put a value in there of hello.
1:30That looks good.
1:32So if we create that, it's now on the system.
1:34So if we do an ls data, we should see that new file there.
1:38And back on the host, we should also see that new file
1:41with the value hello within.
1:43So that's a nice easy way to map a directory on the host
1:46to a container.
1:47But what if we wanted to share data between containers?
1:50What I'm going to do here is exit out
1:52of this container, which will spin it down
1:54and we'll clear the screen.
1:55Now I'm going to recall a few commands ago.
1:57And what we're going to do is just
1:58modify the syntax a little bit.
2:00We're going to remove the path to this directory,
2:02and we're just going to specify a label here.
2:04This is going to be the label of the data volume.
2:07So we'll hit Enter to fire up this container.
2:10Now inside of this container, let's do another ls,
2:12and we mapped it to the same directory within.
2:15But it's not mapped anything on the outside.
2:17It's a data volume controlled and contained within Docker.
2:21Now currently, there is no data within there.
2:23So let's make another file here.
2:24We'll do a new item.
2:25The type here will be file.
2:27The path will be to that local path
2:29here, C colon backslash data.
2:31We'll call this new file.txt, and the value we'll put in here
2:35once again will be hello.
2:38Now let's leave this container running.
2:39I'm going to control pq out of it.
2:42And let's recall it last run command,
2:44and let's run it again.
2:45This will fire up another container.
2:47So we'll have two running.
2:48And both of these containers are referencing that mydata data
2:52volume there, so they'll both be able to see that storage.
2:56So if we do an ls here, we should see that data volume.
2:59And if we do an ls pointing at that data volume,
3:01we should see that new file from another container.
3:04And if I control pq out of this, we can do a Docker ps,
3:09and we should see both of those running containers.
3:11There they are-- dazzling_bardeen
3:13and zen_feisten--
3:15both of them pointing to that same data volume.
3:18Let's take this the rest of the way in the ISE.
3:20These are all of the commands that we just went through.
3:23But we can also manage these volumes here using
3:25Docker volume.
3:27So if we execute this, it should list that one data volume here
3:30called mydata.
3:31There it is.
3:32We can also inspect this data volume here
3:35by running a Docker volume inspect
3:37to get more details about it, and of course, you
3:39can remove these as well with a docker volume rm.
3:43In this CBT Nugget, we covered container data volumes.
3:46We looked at how to share data between hosting containers, as
3:48well as sharing data between containers.
3:51I hope this has been informative for you,
3:52and I'd like to thank you for viewing.
Managing Resource Control
0:00Placing resource controls in our containers
0:02will ensure that they do not compromise
0:04the resources of our host.
0:06Those resources are things like memory, CPU, and storage.
0:10This is very similar to what we do with virtual machines
0:13to ensure that they do not suck down
0:15all the resources of our Hyper-V host.
0:17Let's take a look at how this works with containers.
0:20From the desktop of our container host,
0:22let's jump right into the PowerShell ISE.
0:24Now we place resource controls on containers
0:26when we create them, so this is all done through the Docker run
0:29command.
0:30And let's take a look at the help for this command.
0:32We'll go full view here.
0:33And starting from the top, you can
0:35see we have a good amount of CPU controls available to us.
0:37Some of the big ones here are going
0:39to be CPU count-- the number of CPUs
0:41that our containers can utilize, as well as CPU percentage.
0:44We can control the overall utilization
0:46across all of our CPUs expressed as a percentage.
0:50Another good one is CPU shares, which
0:52allows us to setup a relative weight
0:54amongst other containers, so we can
0:55give our more critical workloads priority access to our CPUs.
1:00You can also use CPU set-CPUs here
1:03to control the number of cores that our containers are
1:06allowed to access.
1:07And as we scroll down here, we can also
1:10see we've got some storage-related controls I/O
1:13max bandwidth and I/O max ops.
1:16These work just like they do with virtual machines
1:18in Hyper-V to limit bandwidth and iApps down
1:21on the disk subsystem.
1:22As we scroll further down here, we also
1:24have a handful of memory controls.
1:26The big ones here are the first two-- memory
1:28and memory reservation.
1:30Memory is a hard limit, meaning that our containers will never
1:33be able to consume more than what we define here,
1:36and memory reservation is a soft limit,
1:38which means it can go above that to complete its tasks.
1:41And those are big three--
1:42CPU, disk, and memory.
1:45Now, if we head back here to code view,
1:47here's how we can utilize it-- dock or run,
1:49specify your option.
1:51And just a quick note here, G is for gigabytes.
1:54M is for megabytes.
1:55B is for bytes.
1:56So those are the abbreviations you can use.
1:58Our first one here is going to limit memory
2:00to 1 gigabyte and CPU utilization to 20%.
2:04Our second one here will limit storage utilization I/O max
2:08bandwidth to 50 megabytes and max IOPS to 100 megabytes.
2:12Another important note here is that these values are not
2:16allocated upon container creation.
2:18These are just limits the-- ceiling in fact,
2:21we can prove that if we fire up Task Manager.
2:24We'll go to More Details here over to performance,
2:27and what we're going to do here is let's
2:28run this first command here.
2:29So I'm just going to copy this to the clipboard
2:31if I can hit it.
2:33There we go.
2:33And now we'll head into the PowerShell console,
2:35paste that in there, and execute.
2:38Now you'll notice here that our utilization is
2:41going to go up a little bit here while it creates the container,
2:43but it's not going to allocate that full gig of memory.
2:47And there you go.
2:48It took a second, but we're inside of the container.
2:50And you can see that memory barely went up.
2:52It went up like 100 megs at most.
2:55One more thing-- a bit of useful information
2:57here as I Control-PQ out of that is you
3:00can use a docker inspect against that container
3:04to view those settings.
3:05In fact, here first, we actually need
3:07to do a docker PS since we didn't name it.
3:10And now we can do a docker inspect 9F--
3:12the first couple of characters there of that container ID.
3:15And as you just scroll up here, you
3:17can see all of these controls within.
3:19There's our CPU percent set to 20%.
3:21And if we scroll a little higher here,
3:23we can see memory set at a gigabyte.
3:25In this CBT Nugget, we covered how
3:26to control resource utilization at the container level
3:30through the docker run command.
3:31I hope this has been informative for you,
3:33and I'd like to thank you for viewing.
Managing Container Images using DockerHub Repository
0:00One of Docker's greatest assets is the Docker Hub.
0:03This allows us to create public and private repositories
0:06where we can centrally store our images
0:08and access them from anywhere.
0:09In this Nugget, we're going to look
0:11at how to create a Docker Hub repository,
0:13and then push images to it and pull images from it.
0:16Here we are in the Docker Hub.
0:18I fired up a browser, navigated to Hub.Docker.com
0:21and logged in.
0:21I also wiped my account here.
0:23So I currently have no repositories within.
0:26If we had the repositories link at the top,
0:28we can create one from scratch here.
0:30I'm going to Create Repository.
0:32Here we can give it a name.
0:33I'm going to call this Nugget Lab.
0:35That's important, because we'll need to have
0:37that in the name of our image.
0:39We can also give it a description here.
0:41And then we can specify our visibility.
0:43I'll create a private repository.
0:45Once that done, we'll head down to the bottom
0:47here and choose Create.
0:49And now we have a bucket to store our images.
0:51Also notice on the right, it provides us
0:53with an example for pushing images into this repo.
0:56Let's head over to our container host and do just that.
0:59Here we are on CN Nug.
1:01Let's get right into the PowerShell ISE.
1:03The first thing we're going to do here
1:04is take a peek at our local image repository.
1:06We have a couple of images to work with here, both
1:09of our Nugget Lab ISIS images.
1:10But again, we are going to need to rename these or create
1:13new images with new names to line up with that repo name.
1:16So we're going to run a couple of Docker tags
1:18here, and rename our IIS image to the name
1:21of the repository colon IIS.
1:23And then our image with my site on it,
1:26we'll rename that to Latest.
1:28With that done, we can rerun a Docker images here,
1:30just to verify that indeed, this looks good.
1:33So we've got our latest image with our site
1:35on it, and our image with just IIS installed.
1:38Now it's time to log into the Docker Hub.
1:40And this is another one of those camp commands here
1:42that doesn't work in the ISE.
1:44It freezes up.
1:45So let's take this into the PowerShell console,
1:47and run a Docker log in.
1:49Now I've already done this before,
1:50so my credentials were cached.
1:52If this is your first time doing it,
1:53it will prompt you for a username and password.
1:56You enter those in, log in succeeded.
1:58And we're back at the command prompt.
2:00So now that we're logged in, we can push our images
2:03into that repository using a Docker
2:05push, and the name of our local image
2:07here, which is CBT Schulte Nugget Lab colon.
2:10We'll push our latest one up there.
2:12And that's it.
2:14And you can see here, this will just take a minute,
2:16as it is a little over 300 megs.
2:19With that done, let's do one more.
2:20I'm going to recall my last command here.
2:23And we'll change latest to IIS.
2:27Now that push finished up, and we're back here
2:29in our repository in the Docker Hub.
2:31And I refreshed the page, and check it out.
2:33We've got two images up here.
2:34There's our latest, and there's our IIS image.
2:37So that's all there is to pushing images up there,
2:39pretty straightforward process.
2:40What about pulling them down?
2:42Well, let's head back into our container host here.
2:44And let's start by removing those local images
2:47that we just uploaded.
2:49And then we'll re-download them.
2:50There it is.
2:51That's gone.
2:52If we look at our local image repository here,
2:54we should see those are gone.
2:55And let's just pull the latest image from that repository.
2:58Here, we just do a Docker pull rather than a Docker push,
3:01targeting our specific image tag there in that repo.
3:05And now it's pulling it down.
3:06And it's done already.
3:07Didn't take long at all.
3:08If we do a Docker images one more time,
3:10we should now see it's in.
3:13So as you can see, the Docker Hub
3:14is just a fantastic feature that's
3:16incredibly easy to work with here, using
3:18Docker push and pull.
3:19And we can access that repository from anywhere.
3:22Our container hosts running in our data center in the cloud.
3:25As long as we have internet access,
3:26we can access these babies from anywhere.
3:29In this CBT Nugget, we covered the purpose of Docker Hub,
3:32as well as how to create a repository, push images to it
3:35and pull images from it.
3:36I hope this has been informative for you.
3:38And I'd like to thank you for viewing.
Managing Container Images using Microsoft Azure
0:00Microsoft Azure gives us yet another method
0:02for storing our container images in the cloud.
0:05That service is known as container registries.
0:08In this Nugget, we're going to look
0:09at how to create our own repository using the Azure web
0:12portal and then push and pull images to and from it.
0:15Here we are in our container host, CN-NUG,
0:17and our first task here is to create a Container Registry
0:20using the Azure web portal.
0:22I've got a browser opened up, and I've already
0:24logged into portal.azure.com.
0:26We're at the home page here.
0:27And what we need to do is hit create a resource,
0:29and we can just search here for containers.
0:32And there's a lot of other great container services up here.
0:34The big one here is Container Instances,
0:36by the way, which we'll host and automatically
0:38run your containers for you so you
0:40don't have to worry about spinning up and managing
0:42a container host.
0:43We're interested in this one right here, Container Registry.
0:46Here we get a nice overview of what this service provides.
0:48Its primary use is for storing and managing container images.
0:52We're going to head down here and choose Create.
0:54Here we provide it a name.
0:55I'm going to call this one Nugget lab.
0:57And then you can choose your subscription, your resource
1:00group.
1:00I've already got a resource group in here.
1:02So I'll just reuse that one.
1:03Choose your location here--
1:04I'm in east US.
1:05And then you can also set up an admin user
1:08and specify your SKU here.
1:10We'll go with standard.
1:11So this looks great.
1:12This will create our container where we
1:14can store all of these images.
1:15A minute or so later and check it out, deployment succeeded.
1:18We can hit this link to go directly to that resource,
1:21or we can come down here to all resources.
1:22It's the only resource I have in here, currently,
1:25and there it is.
1:25We can head into here.
1:26And this will take us right to the overview page.
1:28The most important data point on the Overview page
1:30is the login server right here.
1:32We're going to need to tag our images accordingly,
1:34so they land in the appropriate registry here.
1:37So we'll just make a mental note of this,
1:39and that's all we need to do here in the Azure web portal.
1:42Now we can come to our local machine
1:43and into the PowerShell ISE.
1:45Now at this point, you will need the Azure CLI installed
1:49on your container host, and I've already walked through that.
1:51It's a very simple installation.
1:53That'll give us access to all of the command line utilities
1:56for interacting with Azure.
1:57So the first thing we're going to do here is run an AZ log in.
2:01This will fire up another browser window here
2:03that we can use to log in to the Azure web portal and all
2:06those services.
2:09There we go.
2:09I'm already signed in, so I'll just choose this.
2:12And look at that-- we have logged in to Microsoft Azure
2:14through the command line.
2:16Now next up, we're also going to need
2:17to log into the actual Container Registry that we created.
2:20Again, I named my Nugget lab here.
2:22So we'll do AZ, which is Azure Container Registry log in
2:26and then pass to the name parameter here
2:28the name of that registry.
2:30And this will log us in.
2:31And what this will allow us to do then
2:32is use Docker commands locally to push and pull
2:36our images to that repository.
2:38So that's a really nice touch that we
2:40can use our existing tools and knowledge of Docker
2:43to manage images in the Azure Container Registry service.
2:46All right, let's push an image up there.
2:48Let's take a peek at our local image repository
2:51where we have a Nugget lab IIS image ready to go.
2:54Now we are going to need to rename that using that
2:56log in server here, which is again
2:58the name of your Container Registry.azurecr.io.
3:01So we're going to retag this image right here-- essentially
3:06copy and paste it with a new name into our local repository
3:09that we can then upload to that cloud-based repository.
3:12So we'll run a Docker tag there.
3:14That's done.
3:15And now we can take another peek at our local repository,
3:17and we can see that it is named and tagged correctly.
3:20Now they're all set up.
3:21We can use a Docker push to push that image
3:24up there to that Azure Container Registry.
3:27And there it is--
3:28Docker doing its thing.
3:30All right, and that push completed successfully.
3:33Now if we head back into the portal,
3:34we can give this a refresh here.
3:37And now if we scroll down, we can take a look
3:39at some of these metrics here, and we
3:40should have one image pushed.
3:43And there it is right there.
3:44We can also head down here to repositories.
3:46That's the technical name here for images.
3:49And there is that image.
3:51We can head into it and get the details here
3:53of this image, tag latest.
3:55Now let's head back to the ISE and pull that image
3:58down-- pretty simple process here.
3:59First, we'll remove our local repo image there.
4:03All right, that's gone.
4:04And now we can pull it from Azure,
4:06just like we would pull it from anywhere else-- a Docker pull
4:09there referencing that image up in that container repository.
4:12So I'll run this, and this will just take a second
4:14to pull it back down.
4:16And that's all there is to it-- a very simple service to use.
4:18So for those organizations that have an Azure implementation
4:21in place, you can just use this rather than Docker hub
4:24for storing container images in this CBT Nugget,
4:27we covered how to manage container images
4:29using Microsoft Azure's Container Registry service.
4:32I hope this has been informative for you,
4:34and I'd like to thank you for viewing.
Managing Windows Containers Lab
0:00It's time for another virtual lab where
0:02you'll have the opportunity to get hands-on with managing
0:05Windows containers.
0:06Let's take a look at some of the tasks we'll challenge
0:08you to accomplish in this lab.
0:11We have another small virtual lab environment here containing
0:13just a couple of machines where you'll
0:15be spending all of your time on our container host,
0:17CN-NUG, creating and managing images, as well as containers.
0:22Your first task will be to create
0:23container images manually using the Docker commit command.
0:27We have to base operating system images already installed
0:30in the local repository and ready to go.
0:32You have a Server Core in a Nano Server image,
0:34so you can fire up the Server Core image,
0:36install IIS into it, and then you
0:38use Docker commit to save that image in the local repository.
0:42Your first task will be to create container images
0:44manually.
0:46Now CN-NUG already has two base operating system container
0:49images installed on it--
0:50Server Core and Nano Server--
0:52both ready to go in that local repo.
0:54So fire up a development container
0:56based on that Server Core image, install IIS into it,
0:59and then create your own custom image using Docker commit.
1:03Then you could spin that container back up,
1:05copy a website into it, and create and save another image
1:08using Docker commit that's tagged with my site.
1:11So you'll get some experience there creating and tagging
1:14images manually.
1:15From there, you can take all of those tasks you performed,
1:18wrap them into a Docker file, and automate
1:20the process of building these images using Docker build.
1:24From there, you have a handful of container management tasks--
1:26work with container networking by creating your own custom
1:29transparent network and even modifying the default NAT
1:32network.
1:33You can also work with data volumes
1:34by mapping a directory from the host into a container,
1:37as well as creating shared data volumes to share them
1:40between containers and finally, spin up containers
1:43by placing resource limits on them for memory, CPU,
1:47and storage.
1:48With that, let's jump into our virtual lab environment,
1:50so I can give you a quick tour, show you where to find things,
1:53and get you started with this lab .
1:54Here we are in our container host,
1:56CN-NUG and inside of the Nugget lab directory
1:58is where you can find all of these scripts
2:00to perform many of these tasks.
2:02Another thing I want to point out here
2:04is that you can launch these in the ISE
2:06and copy and paste them into the PowerShell console.
2:08You want to stick with this for running commands just
2:11to avoid potentially the ISE freezing up on you.
2:13And I also want to show you here if we run a Docker images,
2:16we have just a couple of base OS images ready to go.
2:20There's Server Core, and there is Nano Server.
2:23So that's your starting point.
2:24And as always, good luck.
2:25If you need any assistance, refer to the Nuggets
2:28in the Manage Windows container section.
2:31In this CBT Nugget, we've provided you with access
2:33to our virtual lab environment, so you
2:35can get hands on with managing Windows containers.
2:37I hope this has been informative for you,
2:39and I'd like to thank you for viewing.
Team training path
Turn this skill into assignable team training
This free skill is a preview of the courses your team can assign, track, and report on with CBT Nuggets.
$708
seat / year