Gift of Growth Sale-mobile

HomeBlogDevOpsRun Docker on Windows - A Beginner's Guide

Run Docker on Windows - A Beginner's Guide

Published
07th Sep, 2023
Views
view count loader
Read it in
7 Mins
In this article
    Run Docker on Windows - A Beginner's Guide

    Since the emergence of DevOps, there had been a lot of buzz around it as DevOps is a combination of tools, framework, and automation. DevOps aimed to align the Dev and Ops team with shared goals. DevOps practices are applied to other teams as well. For more information about the DevOps training and certification, refer DevOps tools courses 

    DevOps is a mindset, not a toolset. But nothing could workout in an IT team without proper tools. DevOps teams use tools to accelerate and automate the process, thereby ensuring continuous integration, continuous delivery and automation.

    The need for DevOps can be understood by the following example. A developer builds an application and sends it to the tester. But, the environments of development and testing systems are different; thus, the code does not work. There are two solutions to this: Docker and Virtual Machines, but Docker is far better in terms of performance, scaling, and efficiency.

    DevOps teams could also get benefit from emerging technologies like AI/ML. The AI/ML teams can create patterns for DevOps teams so that the DevOps team can leverage the opportunity to find coding problems that cause bugs so that the DevOps teams can dig deeper into it. 

    CI/CD is an essential part of DevOps, it maximizes the development phase thereby reducing the time and effort in integrating, testing and deploying the components. The CI/CD practice shifts the focus of the team on to development thereby increasing the organization productivity, efficiency, testing and collaboration. 

    What is DevSecOps?

    In some of the DevOps models, security teams get aligned with development and operations and throughout the application lifecycle to ensure that the development meets all the compliance requirements from the beginning of the application itself. When there is a focus on security in the DevOps team, then it is referred to as DevSecOps. 

    DevSecOps can be applied to any environment such as cloud native, on premises, hybrid etc. 

    Docker - An Overview

    Docker is a platform that enables creating, deploying, and running applications with the help of containers. A container is a unit of software that packages the code and all its dependencies together such that the application becomes runnable irrespective of the environment.

    Container isolates their application and its dependencies into a self-contained unit that can run anywhere. Container removes the need for physical hardware allowing for more efficient use of computing resources. They provide operating-system-level virtualization. Moreover, developers can collaborate faster without worrying about which software dependency they need to install. 

    A container is a runnable instance of an image. An image is a read-only template with instructions for creating a Docker container. To get more knowledge on docker refer to Kubernetes and docker certification

    Docker is an open source software platform to create, deploy and manage virtualized application containers on a common operating system. Docker packages, provisions and runs containers. Docker packages the application with its all necessary configuration files, dependencies .Each container shares the common underlying Operating system. Software Developers can create containers without docker, but docker makes it more easier to build, safer and simpler to build and deploy containers. 

    Docker components

    1. Docker Engine: It handles the underlying tasks and applications involved in building container-based applications 
    2. Docker Hub: It is SAAS tool that enables users to publish and share their applications through a common library. 
    3. Docker CLI: It is a command line interface tool which is used to run docker commands 
    4. Docker File: It is a simple text file which containers instructions for how to build a container 
    5. Docker Daemon: It is a service which runs in the operating system. 
    6. Docker Registry: It enables you to track image versions in repositories, using tagging for identification 
    7. Docker Containers: It is live, runnable instances of docker images. 
    8. Docker Image: Docker image is bundle of application source code along with all its dependencies, tools and libraries. 

    Why to Use Docker?

    Docker enables 

    • Improved and seamless portability 
    • Light weight applications 
    • Automated container creation 
    • Container Reuse 
    • Container Versioning 
    • Shared Container Libraries 

    Docker Architecture

    It consists of a Docker Engine which is a client-server application with three major components: 

    1. A server is a type of long-running program called a daemon process (the docker command). 
    2. A REST API specifies interfaces that programs can use to talk to the daemon and instruct it on what to do. 
    3. A command-line interface (CLI) client is used to run docker commands.The docker commands are used to start,stop and configure docker 

    How to Install Docker on Windows?

    1. Double-click Docker Desktop Installer.exe to run the installer. 
    2. If you haven’t already downloaded the installer (Docker Desktop Installer.exe), you can get it from Docker Hub.
    3. Once the application is installed, follow the instructions from the installation wizard and proceed with the installation 
    4. Confirm the installation process, Close the wizard once the installation is successful. 

    Install from Command Line

    1. After downloading Docker Desktop Installer.exe, run the following command in a terminal to install Docker Desktop

    "Docker Desktop Installer.exe" install 

    2. If you’re using PowerShell you should run it as

    Start-Process '.\win\build\Docker Desktop Installer.exe' -Wait install 

    3. If using the Windows Command Prompt

    start /w "" "Docker Desktop Installer.exe" install 

    How to Start Docker Desktop Tools?

    4. Docker desktop doesn't start automatically after installation. Search for Docker Desktop in windows and select 

    Before starting the application, Docker offers an onboarding tutorial. The tutorial explains how to build a Docker image and run a container.

    1. In order to proceed with the installation, Click the check box to accept the user terms and conditions
    2. Next, follow the instruction below to install the Docker engine on your system.
    3. Go to Docker CLI and run the Docker version to verify the version of Docker installation on the system.

    Here is a list of elements you should have in order to create and run Docker containers: 

    • Docker Engine: It runs on the host machine to build and run containers
    • Docker Daemon: It manages Docker containers 
    • Docker Client: It runs commands. The command is translated using REST API and delivered to the Docker Daemon
    • Docker Compose: It runs two containers in a single service. 

    How to Start Docker Daemon on Windows?

    To start docker in daemon mode, navigate to docker file location where the docker desktop app is installed and run the dockerd.exe 

    Sometimes there might be an issue with docker like docker daemon not starting, in order to resolve the issue, one can try the following resolution. 

    Resolution 1: Restart the docker service, Go to start→search→services.msc. From the services, screen click on Docker Desktop services→restart. 

    Resolution 2: Using DockerCli.exe, one can switch daemon configuration. One can use the below command to point the docker CLI to either linux or windows. 

    From powershell, 

    PS C:\Program Files\Docker\Docker> ./DockerCli.exe -SwitchDaemon 

    Resolution 3: Restart the docker services using GUI. From the docker GUI, Settings -> Reset – Restart Docker Desktop. 

    What is Docker wsl2? 

    By enabling the wsl2 engine for docker, it enables user to leverage Linux workspaces and users to avoid maintaining both Linux and window build scripts. This enables the docker windows container on Linux. 

    How to Switch Between Windows and Linux Containers?

    From the Windows desktop menu, you can select which daemon the docker CLI talks to. One can select ‘Switch to window containers’ to use window containers and select ‘Switch to Linux containers’ to use Linux containers. 

    How to Uninstall the Docker Desktop Tool?

    To uninstall Docker Desktop from your Windows machine 

    1. Navigate to the Windows Start menu, select Settings > Apps > Apps & features. 
    2. Select Docker Desktop from the Apps & features list
    3. Select and Click Uninstall 
    4. Confirm once the tool gets uninstalled. 

    Conclusion

    Installing the docker on windows can be done by following the above-mentioned steps. One can use docker CLI windows to start, stop and configure the containers. Above are mentioned steps to install docker on windows. For more information refer to docker classes.

    Frequently Asked Questions (FAQs)

    1Can Windows 10 run docker?

    Yes, docker can run on windows 10. Docker can run on Windows 10/10 pro and Windows 11/11 pro. For details about the system specifications, refer to docker specifications.

    2How can I run Docker on Windows?

    Once the Docker is installed using the docker installer, go to windows start and search for Docker Desktop. Start the Docker Desktop application. 

    3Is docker free of cost for windows?

    Docker Desktop is licensed as part of a free (Personal) or paid Docker subscription (Pro, Team, or Business).Depending on the usage one can obtain the subscription. 

    4Do windows containers run on Linux?

    No, Windows containers cannot run on Linux. Since the containers use the underlying Operating system, resources and drivers. Hence Window containers should run on Windows Operating system and Linux Containers should run on Linux operating systems.

    Profile

    Lakshmi Sushmitha V

    Author

    I am an ambitious software professional with 5 years of experience in the industry working with various tech  gaints. I am an inquisitive person who always interested to explore the things and takeup challenges.Apart from profession , I love travelling,reading books,blogging and editing.

    Share This Article
    Ready to Master the Skills that Drive Your Career?

    Avail your free 1:1 mentorship session.

    Select
    Your Message (Optional)

    Upcoming DevOps Batches & Dates

    NameDateFeeKnow more
    Course advisor icon
    Course Advisor
    Whatsapp/Chat icon