Before writing this article, I had never worked with Docker before. In fact, I didn't even know what it was. However, through a lot of Googling and trial-and-error, I found enough information to go from crawling to slowly walking. Let's get you there too.
In this demo, I'll be covering what Docker is, how to download it on Windows 11 OS, and getting Docker Desktop up and running with an example GitHub repo.
Docker is a platform-as-a-service (PAAS) software that allows users to put their entire application into a virtual "container." This means that, rather than using your desktop to host an application, you can isolate your entire app within a single container--allowing you to manage multiple applications at once and utilize multiple versions of required software for your applications. All of this means you can manipulate your applications with more power and flexibility than was previously possible.
For more information about containers and Docker's logic, go to this guide.
Before we get into the steps, you need to make sure your machine is running Windows 11 and is at least 64-bits. You can do this by navigating to the Windows Settings application and going to System > About. In this menu, you'll find your System Type and Windows Edition.
Click this link and click the "Download for Windows" button. Your version should be automatically detected.
Once you've downloaded the installer, run it. At this point, you'll be taken through the setup wizard. When you finish this, you should be able to open the application.
Docker has some ancillary tools that you also need to install just to get it up and running, so you'll likely receive an error when you first try to open it. It happened to me, and this is the error message I saw:
Do not worry, the resolution is very simple...
WSL, or the Windows Subsystem for Linux, helps ensure Docker can compatibly run with your Windows computer. To install it, you can click the link in the error message shown above if it pops up on your screen when you try to open Docker, or you can go to this link.
Go through steps four and five of the instructions in that link, then try closing Docker and opening it again.
When you re-open Docker, it should open successfully and you'll see a tutorial. I highly recommend going through it, as it's brief but helpful in getting you acclimated to the system.
Since this was my first time using Docker, I had to sign up using the button in Docker Desktop. If you've never used Docker, it's worth creating an account so you can use the platform to its fullest.
At this point, you've successfully installed Docker Desktop! Next, we'll take a look at how to get started with an example demo.
To get started, we'll need a GitHub repo with a fully-fledged application. In my case, I'll be using HAXcms: a content management system that encapsulates the incredibly accessible authoring experience of HAX. Let's get going!
Navigate to the "Dev Environments" Tab in Docker Desktop, and click the "Create" button. Click the "Get Started" button in the guide that pops up, and the following screen should appear:
As you can see in the image, I've already put a link into the "Enter the Git Repository" box. Below, I'll show you where to get a link to put in this box.
Navigate to your GitHub repo of choice, and select the green "Clone" button. A dropdown menu should populate, and you'll want to copy the link that appears in the HTTPS tab. Kind of like this:
Paste the link you copied into the "Enter the Git Repository" box, and click the "Continue" button.
The Dev Environment will take a little time to generate, then you'll see a page indicating that it's all set up.
At this point, your Dev Environments tab in Docker Desktop should be showing the container you created and your Containers/Apps tab will show that your container is running. Way to go!
Now, you can start working with your container in VSCode. To do this, click on the container listed in your Dev Environments tab. It should look similar to this:
To open VSCode, just click the button. When you do, you may have to install one or two additional tools--or even VSCode itself if you don't have it already. If this is the case, follow the steps provided and you'll be viewing your container's code in no time!
For more information about Docker and initial steps, feel free to view this guide from freeCodeCamp. I found it very useful, especially for learning about Docker's basic commands. Good luck!