Select the Gcore Platform

Gcore Edge Solutions
Go to Gcore Platform →
Products:
  • Edge Delivery (CDN)
  • DNS with failover
  • Virtual Machines
  • Bare Metal
  • Cloud Load Balancers
  • Managed Kubernetes
  • AI Infrastructure
  • Edge Security (DDOS+WAF)
  • FaaS
  • Streaming
  • Object Storage
  • ImageStack (Optimize and Resize)
  • Edge Compute (Coming soon)
Products:
  • VPS Hosting
  • Dedicated Servers
  • SSL Certificates

Deploying with Docker on Windows

Share

Today, container technology is one of the most popular and essential tools for producing and deploying various applications. Docker is one of them. It has gained popularity over the past years and has been using this technology as a native system. But container technology was designed only for Linux or server systems.

At the same time, most regular users use Windows as their primary system and cannot install other systems. There are several solutions for such users on the Windows platform that allow them to get experience with the Docker system and make deployment for simple or unloaded projects.

Currently, the most popular components are Docker Toolbox and Docker for Windows, which provide all the necessary components to run Docker on Windows. Let’s take a deeper look below at their features and options in terms of simplicity and functionality for a regular user.

We assume that the reader of this blog knows the Docker basics so that we will focus only on the main and distinctive features.

Docker and Windows

Let’s say right away that Docker solutions for Windows use system resources not in a direct way, but with the technology of Virtual Machines (VM). By default, the Docker Toolbox uses VirtualBox, which creates a special terminal with Docker Machine, while Docker for Windows uses Hyper-V virtualization technology. These tools make it easy to run the Docker on a Windows platform in just one step. Let’s see how all of these components interact with each other in the following diagram.

The diagram describes in steps the implementation of Docker’s functionality and capabilities for Windows platforms:

  • initialize or define an algorithm that uses the required Docker functionality,
  • build VM (or Hyper-V technology) with the Docker Machine,
  • run the Docker Toolbox or Docker for Windows terminal,
  • execute the Docker commands.

Usually, all these steps are performed by the start script with Docker Terminal. Such number of steps is explained by the fact that Docker uses Linux features that Windows doesn’t currently support. Note that the Linux version can perform all these steps only in one step.

Docker Toolbox and Docker for Windows

An important step in the interaction between Docker and Windows is to choose the appropriate tool: Docker Toolbox or Docker for Windows. Their algorithms for interacting with Windows are similar in general but have their features and usage requirements, so let’s explore them in more detail below.

Docker for Windows (or Docker Desktop) is the most up-to-date version of Docker at the moment. It requires Windows 10 Pro, Enterprise, or Education version. Home edition doesn’t support it since the Hyper-V virtualization service cannot be installed on it. The disadvantage of this solution is that you will not be able to run other VM services for your purposes.

Docker Toolbox is an older version of the Docker that is not currently being updated. At the same time, it is also popular because it has lower system requirements, which means supporting VM VirtualBox. So, if you are using older versions of Windows or even macOS, then Docker Toolbox is a simple and practical solution to use Docker service. It should be noted that the functionality of the Docker Toolbox, in general, allows you to perform all the necessary deployment tasks.

There is also another one, a complex and time-consuming solution It is based on using VM and installation procedures for one of the Linux distributions and configuring Docker for it. This solution is not for all users as it includes several DevOps tasks that generally complicate the deployment process.

The decision to choose a specific solution depends primarily on the platform and the purpose of using Docker. In general, if system requirements allow you to use Docker for Windows, we recommend you to use it as the most relevant and functional system. However, for this topic, we will use Docker Toolbox as an example of the most frequently used version at the moment.

Install aspects for Docker Toolbox

The installation process of the Docker Toolbox for Windows is simple and intuitive since all components are included in one package. All details of the installation are described in the official guide, so we’ll focus only on the main aspects and features of installation and configuration.

The installation process involves several main steps, let us briefly describe them:

  1. Define the installation path for the Docker Toolbox: leave it as default to avoid system file access problems in the future.
  1. Select additional components that can extend the functionality of the Docker toolbox. We can’t change the main components (highlighted in grey), and from the additional components we can select the following ones:
  • Docker Compose manages containers, connected resources, and networks.
  • Kitematic, the Docker graphical user interface (GUI) to control and configure specific containers.

Note: A selection of these components depends on your requirements. We advise you to select the option “Full installation”, as the components are lightweight and will not take up much system resources.

  • Keep “Additional tasks” items as default. The driver selection item should be checked only if you are sure that the hardware of the server (or computer) supports only the old driver.
  1. Next step, you should permit to install the Oracle VM VirtualBox driver several times, unless you have done it earlier.
  1. After completing the installation, make sure that everything passed correctly and that the Docker Toolbox component labels appear on your desktop.
  1. Use the shortcut to start Docker Quickstart Terminal and wait for the end of the automatic setup and configuration of VirtualBox and Docker Machine in the terminal.

Note: this step for the first time will take a relatively long time (depends on the choice of VirtualBox hardware setup), but the next time the launch will be faster.

If you’ve done all these steps correctly, the terminal will show you the command line with an ASCII art picture with Whale and an IP address which is important for future operation with Docker Terminal and Windows.

Now we have the terminal prepared to accept and execute Docker commands.

Note: Docker Quickstart Terminal command line uses bash, which is the Linux command.

Docker interaction with Windows

Docker Toolbox provides several services, utilities, and tools that create a Linux virtual machine with Docker functionality. For a deeper understanding of their interactions, let’s show them in the following chart.

  • Docker Machine is a tool that deploys virtual machines (hosts) with the Docker Engine configured on remote physical or virtual servers.
  • REST API defines interfaces between Docker’s components.
  • Docker Engine is a client-server application that implements the Docker containerization functionality.

As we can see, the Docker Machine is the connection and control component between Docker Toolbox and Windows. Next, we’ll use it in our Deployment examples.

Docker Toolbox workflow aspects

Docker represents a client/server architecture and contains several basic components that access the server using the REST API interfaces. Therefore, we will describe them briefly below for a better understanding of the Docker Toolbox workflow in Windows.

  • Docker Daemon is the main part of Docker that runs on the host system. It can perform some operations with its images, and also run containers, process their status and set up connections between its components – Docker Machines. It is important to note that Daemon can only run on Linux systems. Therefore Windows VM services should be used with it.
  • Docker terminal is a command-line tool with functionality that allows control and operate Daemon services. Also, this tool works locally or remotely over a network or cloud.
  • Docker Hub – is a base of various container images, from Linux to special services or programming languages.

In view of the chart above, let’s describe the Docker Toolbox workflow.

  • Quickstart terminal sends a command to Daemon that is deployed with VM.
  • Interaction between client and daemon provides REST API.
  • Daemon uses the Docker Hub (or private registries) to access Docker images.
  • Daemon performs operations with Docker Images on the instructions, according to Dockerfile.
  • User runs the container.
  • User sets parameters for Docker Machine access from the Windows platform.

In general, these steps are the same as for Linux systems, except for the first and last. The main differences are in the configuration and use of VM.

Once the container is started, all actions are moved to its level. These operations differ from the native version only by what is inside VM. Therefore, we will not review them in detail and will focus only on the key steps:

  • Check for Docker Image on the local resource.
  • If required, download Docker Image from the Docker Hub.
  • Build a container from an image.
  • Create a network interface and set an IP address.
  • Run the application in the container.

Docker Toolbox mounting option for folders

There are some features and details that appear with Docker Toolbox that are specific only for Windows. The Mounting of extra folder and files is one of these features that most users come across in their work, so let’s review and describe it.

The Docker settings allow limited access to the file system. And in case you place your project outside your home folder, you will need to connect it using VirtualBox settings. It is necessary to do the following actions:

  • Select settings VM (Docker Machine).
  • Define the appropriate external folder in the Shared Folders section.
  • Define access parameters.
  • Restart VM.

After that, the Docker Machine will access the files in a shared folder. But it’s important to note that all files and folders mounted from the host machine will be set to 755 (rwx r-x r-x) access mode.

Running Docker on Windows

We reviewed aspects of Docker Toolbox’s interaction with Windows and highlighted key workflow steps specific to this system. Now, we will show the deployment process for Windows by examples.

Docker Machine access in Windows

When we run Docker Images, these images will be inside VM. So to access them, we’ll need the VM’s IP-address which we got earlier with starting Docker Machine. This is a private address in a virtual network on PC, so let’s check to see if the Windows command line can access the created Docker Machine host.

So we got a response and Windows PC can connect to the VM with Docker image.

Deploying process with sample images

We’ll use the images on the Docker Hub and run hello world containers for testing purposes on the Windows system.

As we can see, the HelloWorld image is running, and it shows that we have successfully created a Docker container on the Windows platform.

Next, let’s follow the same approach and put in the container a simple page site. But unlike the previous example, in addition to the basic commands, we’ll use flags to configure the container more precisely.

The first thing we will do is to run the image and select the flags (parameters) in such a way that the resulting hosting was shared and did not depend on the terminal.

After the docker executes the command, we see that the image was downloaded successfully. Now let’s check if this image is running as a container.

As a result, we see that the container and the associated host from the simple page site is running. We can verify this by navigating to the appropriate IP address and port with a browser.

Now, we have a web server with a simple page running inside a Docker container on Windows. As you can see, this process is quite simple, and it takes just a few minutes. Using the same approach you can create your images and containers to run your software.

Container operations with Docker Machine

Besides the fact that we can perform various operations on prepared images (or create them), we can also manage containers with Docker Machine. Let’s demonstrate this by creating a new host.

The first thing to do is to check the VM list.

We can see that we have one VM created during the previous steps. But now we are going to add another one, which will possibly host other software.

Then we make sure that VM is created and ready to work with containers.

As a result, we got another VM, which will allow us to deploy containers for other tasks using the approach above.

Also, the task of connecting Windows to remote VM environments often appears. To do it, you need to define and set values of environment variables.

But with this solution, a problem appears that the variable values are set only for the current terminal. So, it is necessary to automatize the process with a bash script or to use a more flexible solution.

We reviewed the basic operations that are required to work with the Docker Toolbox and Docker Machine on Windows. A list of full functionality and commands is available on the official site.

Summary

In this blog, we have discussed the aspects of running Docker on Windows. We focused on the Docker Toolbox for Windows solution and provided basic installation instructions and usage patterns.

Perhaps this material will help and simplify the Deployment process for your applications with Docker and Windows. But at the same time, if you want to get a smoother development experience with Docker, then we recommend using the native version for Linux systems.

Subscribe to a useful newsletter

Favorable offers and important news once a month. No spam.