You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

87 lines
15 KiB

import { addBanner, addArticle, addTitle, addHeader, addParagraph, addSubHeader } from '/scripts/article.js';
import { addInset, addInsetList, addInsetCodeListing, addInsetBulletList } from '/scripts/inset.js';
import { addImageWithCaption, addButtonGroup } from '/scripts/visuals.js';
import { addSidebar} from '/scripts/sidebar.js';
import { addSyntax } from '/scripts/code.js';
const heading = document.querySelector(".heading");
const global = document.querySelector(".global_menu");
const local = document.querySelector(".local_menu");
const sidebar = document.querySelector(".sidebar");
const main = document.querySelector(".main_content");
heading.append(addTitle("Docker For Windows"));
heading.append(addParagraph("David Davis - LinkedIn Learning - November 2018"));
heading.append(addParagraph("Chapter 2 - DOCKER FOR WINDOWS: GETTING STARTED"));;
main.append(addHeader("REQUIREMENTS TO INSTALL DOCKER FOR WINDOWS"));
main.append(addParagraph("installing Docker in Windows is fairly straightforward and the online documentation for this and for Docker in general seens to be really good, You can start by downloading it from <a href='https://docs.docker.com/get-docker/'>Get Docker</a>. It may also be worth checking out the <a href='https://docs.docker.com/desktop/install/windows-install/'>system requirements</a>."));
main.append(addParagraph("These seem pretty straightforward and shouldn't present any problems. There is no 32 bit version for windows but 32-bit systems are pretty rare now so if your PC is no more than 10 years old, you should be able to run Docker. I have installed on a system that is now almost 10 years old and runs the Home edition of Windows 10. I currently have it running on a new system with Windows 11 Pro."));
main.append(addParagraph(" Note that David, in the course video, mentions the editions of Windows 10 that you can install Docker on and doesn't mention the Home Edition. At the time of writing, the course is five years old and requirements can change. If you check out the <a href='https"));
main.append(addParagraph("If you want to install Docker in a Windows VM, the documentation suggests that support for that is limited. This is not something I have tested but be aware of it if you do intend to run it in a VM."));
main.append(addParagraph("when you install Docker in Windows, you are really installing a mini suite of applications. As well as the Docker Engine, there is also the Docker CLI, Docker Compose, the Docker Machine and Kinematic."));
main.append(addParagraph("For more information on anything related to Docker, it is a good idea to check out the online <a href='https"));
main.append(addHeader("INSTALLING DOCKER FOR WINDOWS"));
main.append(addParagraph("The course recommendation for installing Docker is to get the version on the edge channel rather than the stable channel. This wouldn't be a concern now since any features that would only have been in the edge channel in 2018 would be in the stable channel now. However, there doesn't seem to be different versions available and the single version that is available will obviously be the stable version."));
main.append(addParagraph("Changes to software can present problem when you are following along, but the latest version should be able to do everything that the version used in the course can do. If you want to check on the version you are running, you can right-click on the Docker icon in the system tray and select About Docker or About Docker Desktop and this will give you a quick summary."));
main.append(addParagraph("Figure 3 shows this summary and this is from the course video so it shows us that David had installed the Community Edition and it is on the edge channel."));
main.append(addImageWithCaption("./images/figure3.jpg", "Figure 3 - the Docker version in 2018"));
main.append(addParagraph("For comparison, figure 4 shows the same thing on my own PC so this is a version that was downloaded and installed in November 2023."));
main.append(addImageWithCaption("./images/figure4.jpg", "Figure 4 - the Docker version in 2023."));
main.append(addParagraph("Another way to get some information is to run the following command at the command line."));
main.append(addSyntax("docker version"));
main.append(addParagraph("Figure 5 shows the output this gives us if we run the following command in PowerShell, but you would get the same result from a command prompt or the Docker CLI."));
main.append(addImageWithCaption("./images/figure5.jpg", "Figure 5 - the output from the docker version command."));
main.append(addHeader("INSTALLING KITEMATIC"));
main.append(addParagraph("Kitematic is the GUI for Docker. It allows you to perform the same tasks as the Docker CLI and that includes downloading, running and administering containers."));
main.append(addParagraph(" In my version, it is automatically installed along with Docker, but if it's not, you can right-click the docker icon and select Kinematic which will open a dialog box that will allow you to download and install it."));
main.append(addParagraph(" I suspect this will be irrelevant for most users but may be useful if you, for some reason, need to install an older version of Docker."));
main.append(addParagraph("Given the difference in versions between the one used in the course videos and the version I am using, in a lot of cases, the course may be difficult to follow. As an example of that, in the course video, Docker has a link to the CLI in the bottom left which is not in my version."));
main.append(addParagraph("As far as I can tell, there is no way to access the CLI from the Docker Desktop. This isn't really too much of a problem because I can use a windows CLI but the important thing to remember is that Docker has changed quite a lot over the last few years so you should understand that if you are looking at information that is more than a year old, t may no longer apply. That makes the online <a href='https"));
main.append(addParagraph("One feature of the Docker Desktop that looks pretty similar in both versions is the search feature which you can use to search for images or for information in the documentation."));
main.append(addHeader("CONFIGURING DOCKER FOR WINDOWS"));
main.append(addParagraph("There are a couple of ways to access the settings in Docker. If Docker is running, you can right-click it's icon in the system tray or in Docker Desktop, you can simply click the settings cog in the top right."));
main.append(addParagraph("This will give you access to just about anything you can configure in Docker and anything you can do here can also be done from the command line, which you would do either with a docker command or by manually editing the config files."));
main.append(addParagraph("In the GUI, the settings are grouped into a number of categories so let's look at some of these. These are described as seen in the current version which has some differences compared to the version in the course video."));
main.append(addSyntax("General"));
main.append(addParagraph("This covers Docker's behaviour and appearance. For example, you can enable/duisable Docker startup when you log into Windows and also enable/disable Docker Dashboard at startup. You can also select your Docker Desktop theme here."));
main.append(addParagraph("The older version of Docker uses a Moby virtual machine to allow you to use Linux containers in Windows, but in the current version, you can use the WSL in Windows instead and you can enable/disable this in the general settings."));
main.append(addSyntax("Resources"));
main.append(addParagraph("You might notice that unlike the course videos, the options here don't include hardware resources such as the number of CPUs or the amount of hard-drive space. This allows you to configure the Moby VM, but you don't need to do that for the WSL because it's not a VM so it just runs as a standard application."));
main.append(addParagraph("You can configure the WSL here including the distro you use with Docker. You can also configure your network address which for me shows 192.168.65.0/24 and I will leave that for now. I would guess that configuring this will determine whether or not the container can be accessed from the outside world. For example, if this were on the same network as my Windows 11 PC, I should then be able to ssh to it from an ssh client on the PC."));
main.append(addSyntax("Docker Engine"));
main.append(addParagraph("This allows you to configure the Docker daemon and this is not something you would want to do as a beginner."));
main.append(addParagraph("Other configuration includes Kubernetes which we will look at shortly, Software updates, Extensions, Features in development and Notifications."));
main.append(addHeader("CONTAINER ORCHESTRATION WITH KUBERNETES"));
main.append(addParagraph("You don't really need Kubernetes to run a stand-alone container, but you will often use it in a production environment. Kubernetes is used for the deployment and orchestration of containers and there are several other tools such as Docker Swarm that do the same thing, but Kubernetes is the most popular at the moment."));
main.append(addParagraph("Kubernetes requires at least v 18 of the Docker Engine to run but this won't be an issue if you have a reasonably recent installation. You can enable it from the option under the Kubernetes tag in settings."));
main.append(addParagraph("This is a stand-alone Kubernetes server and client and it integrates with the Docker CLI. It is not configurable but when enabled, it gives you access to a number of commands including the kubectl (Kubernetes control) command."));
main.append(addParagraph("One final note, at this point, we are using Linux containers, but We will look at using Windows containers later in the course. It is important to remember that Kubernetes can only be used with Linux containers, it will not work with Windows containers."));
main.append(addHeader("RUNNING WINDOWS AND LINUX CONTAINERS"));
main.append(addParagraph("If you right-click on the Docker icon in the system tray, you can select the option to 'Switch to Windows containers...' and this is because, for me, it is currently configured to use Linux containers."));
main.append(addParagraph("In the course video, David demonstrates the use of the Hyper-V Manager. If you are running a Moby VM, you will see it here and will be able to manage it, just as you would be able to via the Docker settings."));
main.append(addParagraph("As a matter of interest, figure 6 shows you the Hyper-V Manager on my Windows 11 machine and I have one container running on it."));
main.append(addImageWithCaption("./images/figure6.jpg", "Figure 6 - Hyper-V Manager running on my Windows 11 PC."));
main.append(addParagraph("This is just taking us back to the point that the current version of Docker doesn't use the Moby VM, or any VM at all in fact, so there is nothing for us to manage here."));
main.append(addParagraph("So that makes it a little easier for us to run and manage Linux containers since we don't have to manage a VM and we don't need to worry about allocating resources to it."));
main.append(addParagraph("Before the course moves on to Windows containers, let's just take a brief look at running a Linux container. We can do that from a command line with a command such as"));
main.append(addSyntax("docker run -it ubuntu bash"));
main.append(addParagraph("This will open up an Ubuntu container and give us access to the bash shell. It takes a few seconds to do this because I didn't have an Ubuntu container so this has been downloaded for me. If you take a look at figure 7, this is a PowerShell window where, as you can see, the command to run the container has been executed."));
main.append(addImageWithCaption("./images/figure7.jpg", "Figure 7 - a Linux container running in PowerShell."));
main.append(addParagraph("You can also see that Docker displayed a message telling us that it couldn't find the ubuntu image so it has been downloaded and then I ran a couple of commands to demonstrate the fact that this is now a bash shell. As matter of interest, if you run these directly in PowerShell or at a command prompt, the ll command will not be recognized."));
main.append(addParagraph("The dir command will run but the output is very different. In figure 7, for example, ll gives a closer approximation the dir command in DOS and this shows the permissions and the owner/group owner that you don't see with dir (or at all in DOS)."));
main.append(addParagraph(" If we now select the option to switch over to Windows containers, a dialog box will pop up to let us know that we will no longer be able to manage Linux containers umtil we switch back to using them, but they will continue to run and we won't be losing any data. This is shown in figure 8."));
main.append(addImageWithCaption("./images/figure8.jpg", "Figure 8 - the dialog box shown when you switch to using Windows containers."));
main.append(addParagraph("Side note. Switching to using windows containers seemed to break Docker for me. It seemed to be unable to start up the Docker Engine. After a bit of digging, I found the solution in a You Tube video. <a href='https"));
main.append(addParagraph("Essentially, I missed a step when installing Docker and this is something that probably didn't apply in 2018 so it wasn't covered in the course videos."));
main.append(addImageWithCaption("./images/figure9.jpg", "Figure 9 - enabling containers in Windows Features."));
main.append(addHeader("Go back and edit the section on installation to include this and check if it is mentioned in the installation docs."));
main.append(addParagraph("Now that we have enabled containers , Docker has successfully switched over to using Windows containers. You can confirm that by clicking on the Docker icon in the system tray and you will see there is now an option to switch to Linux containers."));
main.append(addParagraph("If you switch to your command line and run a command like"));
main.append(addSyntax("docker images Is"));
main.append(addParagraph("you should see that there are no images there and this will be the case, even if you still have some Linux images because we are only seeing windows containers here."));
main.append(addParagraph("Conversely, if we switch back to Linux containers we will be able to see those Linux images but we will not be able to see any Windows images we might have downloaded."));
main.append(addParagraph("My interest in Docker is really more for use with Linux containers, but for the rest of this course, we will be looking only at Windows containers. There are other Docker courses and I would guess that these focus more on using Linux containers."));
main.append(addParagraph("In the conclusion, I will mention some of these courses and mention a little, if possible, about the extent to which they focus on Linux containers."));
addSidebar("programming");