How to Install Docker on Windows 11

June 30, 2024 Docker

Docker offers several benefits for application development, making it a popular choice among developers and DevOps teams. Let’s explore why Docker is advantageous:

  1. Consistent and Reproducible Environment:
    • Docker ensures that your development environment remains consistent across different stages—local development, testing, and production.
    • Reproduce the exact environment on any machine, reducing the “it works on my machine” problem.
  2. No Clutter on Your PC:
    • With Docker, all the software required to run your app is inside the container.
    • No more clutter from multiple versions of Node, Python, or database management tools on your host machine.
  3. Isolated Environment:
    • What happens in the container stays in the container.
    • Install dependencies without affecting your host machine, and vice versa.
  4. Works Anywhere:
    • Develop on any computer with Docker installed.
    • Collaborate seamlessly with colleagues—no lengthy software installations required.
  5. Easy Cleanup:
    • When done with a project, delete the Docker image and containers.
    • Reclaim disk space without manual cleanup.
  6. Efficient Disk Space Usage:
    • Docker optimizes storage by sharing common layers across images.
    • Ideal for developers with limited disk space.
  7. Fast Deployment and Testing:
    • Docker containers start quickly, enabling rapid development iterations.
    • Easily create new instances and migrate between environments.
  8. Collaboration and Portability:
    • Share Docker images across teams and environments.
    • Run your service on cost-effective hardware.
  9. Strong Community Support:
    • Docker has a vibrant community with extensive guides for various languages and frameworks.

Docker streamlines development, enhances collaboration, and provides a consistent, isolated environment. Whether you’re building microservices, web apps, or APIs, Docker simplifies the process and accelerates your development workflow.

Now let’s jump into how to install Docker on your Windows 11 PC.

1. Download Docker Desktop

  • Head over to the Docker website and download Docker Desktop for Windows.
  • Make sure to grab the latest version.

2. Run the Installer

  1. Open the installer file you just downloaded (usually located in your PC’s Downloads folder).
  2. Grant administrator privileges if required.
  3. Follow the setup wizard to complete the installation of Docker Desktop.

3. Restart Your PC

  • After installation, restart your PC for the changes to take effect.

System Requirements

Before proceeding, ensure that your system meets the following requirements:

  • Windows 11 64-bit:
    • Home or Pro version 21H2 or higher, or Enterprise or Education version 21H2 or higher.
    • Minimum required version: Home or Pro 21H2 (build 19044) or higher, or Enterprise or Education 21H2 (build 19044) or higher.
  • WSL 2 backend:
    • Turn on the WSL 2 feature on Windows. Refer to the Microsoft documentation for detailed instructions.
  • 64-bit processor with Second Level Address Translation (SLAT).
  • 4GB system RAM.
  • Enable hardware virtualization in BIOS (VT-x or AMD-V).

Important Notes

  • To run Windows containers, you need Windows 10 or Windows 11 Professional or Enterprise edition. Windows Home or Education editions only allow you to run Linux containers.
  • Docker Desktop is not supported on server versions of Windows (such as Windows Server 2019 or Windows Server 2022).

Hyper-V vs. WSL

  • Docker Desktop’s functionality remains consistent on both WSL and Hyper-V. Choose based on your specific setup and use case.
  • Containers and images created with Docker Desktop are shared between all user accounts on the machine where it is installed.

Additional Considerations

  • Running Docker Desktop inside a VMware ESXi or Azure VM is supported for Docker Business customers (requires enabling nested virtualization).

Let’s walk through the steps to run and test NGINX using Docker Desktop. Docker Desktop simplifies container management and allows you to work with containers seamlessly. Here’s how you can get started:

  1. Install Docker Desktop:
    • If you haven’t already, download and install Docker Desktop on your Windows 11 machine.
    • Choose the appropriate version (x86_64 or Arm) based on your system architecture.
  2. Pull the NGINX Image:
    • Open Docker Desktop.
    • In the top navigation bar, click the Search field.
    • Search for the NGINX image by typing “nginx.”
    • Click the Pull button to download the official NGINX image from Docker Hub.
  3. Run the NGINX Container:
    • Once the image is pulled successfully, select it from the Images view.
    • Click the Run button.
    • Configure the container settings:
      • Specify a Container name (e.g., “my-nginx-container”).
      • Map port 80 on your host machine to port 80 in the container (use the Publish option).
    • Click Run to start the NGINX container.
  4. Access the NGINX Welcome Page:
    • Open a web browser and navigate to http://localhost:80.
    • You should see the default NGINX welcome page.
    • Alternatively, use tools like curl or access the container shell to verify NGINX installation.
  5. Customize NGINX Configuration (Optional):
    • If you want to serve custom content, create an NGINX configuration file (e.g., my-nginx.conf).
    • Mount the configuration file into the container using Docker volumes.
    • Update the NGINX configuration to point to your custom content.
  6. Test Your Custom Content:
    • Reload NGINX inside the container to apply the new configuration.
    • Access your custom content via the browser (e.g., http://localhost:80/my-custom-page).

That’s it! You’ve successfully run and tested NGINX using Docker Desktop. NGINX is now serving content from within a container. Explore more NGINX features and experiment with different configurations!