Test Drive 5 Cool Linux Applications on Docker Desktop for Windows Platform

Estimated Reading Time: 6 minutes

Docker Desktop for Windows Release is available. This release comes with Docker Engine 18.09.2, Compose v1.23.2 & Kubernetes v1.10.11. One of the most anticipating feature introduced with this release is around the process isolation feature on Windows 10 for the first time. Process-isolation containers were already possible on Windows Server, but for the first time they are now also available on the regular Windows 10 of your laptop. One need to install the Docker Desktop Edge version or newer to get benefit of process isolation feature. Please remember that Docker Engine should be at version 18.09.1 or higher.You must select a Windows base image from Dockerhub that matches the kernel of your host’s Windows version.

Can I run Linux-based application on Docker Desktop?

Yes, it is possible today. With Docker Desktop for Windows, it is possible to run Linux containers on Windows. All you need to do is to simply click on “Switch to Linux Containers” option under Preference Pane UI and start building and running Linux-based application. That’s it.

Under this blog post, I will be demonstrating Top 5 cool Linux based applications to run on Docker Desktop for Windows platform.

  • Running NGINX Application on Docker Desktop
  • Running Your Own customized Web application on Docker Desktop
  • Building a Single Node Docker Swarm Cluster
  • Running Docker Swarm Visualizer Tool on Docker Desktop
  • Running WordPress Application on a single Node Swarm Cluster
  • Running Elastic Stack Application on Docker Desktop

Installing Docker Desktop for Windows Platform

Let us started with a simple installation of Docker Desktop. Open https://hub.docker.com/editions/community/docker-ce-desktop-windows and click on “Login to Download” page to download and install Docker Desktop for Windows. Once you install Docker Desktop, you can see “whale” icon appear in the below taskbar(as shown below):

Checking Docker Version

There are two ways to verify Docker version – one through UI and other via CLI. To verify it via CLI, all you need is to run docker version to check the basic details of your deployment. You should see “Windows” listed as the operating system for the Docker client and the Docker Engine:

Client: Docker Engine - Community
 Version:           18.09.2
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        6247962
 Built:             Sun Feb 10 04:12:31 2019
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
  Version:          18.09.2
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.6
  Git commit:       6247962
  Built:            Sun Feb 10 04:13:06 2019
  OS/Arch:          linux/amd64
  Experimental:     true
  Version:          v1.10.11
  StackAPI:         Unknown
PS C:\Users\Ajeet_Raina>

The OS/Arch field tells you the operating system and CPU architecture you’re using. Docker is cross-platform, so you can manage Windows Docker servers from a Linux client and vice-versa, using the same docker commands.

Running Your First NGINX application

Let us start with “Hello World” example of web application to test drive our first application. Run the below command to bring up NGINX app which runs on port 80 on your laptop system.

PS C:\Users\Ajeet_Raina> docker run -d -p 80:80 nginx

That’s it. Open up your favourite browser and be ready to see NGINX default page instantly. Cool…isn’t it?

Running Your First Nginx based Docker Container

Under this example, I will showcase how to bring up your customized webpage. All you need to do is bring up your 2nd webpage to run on available port 81 as shown below:

PS C:\Users\Ajeet_Raina> docker run -d -p 81:80 ajeetraina/hellowhale

You can refer to https://github.com/ajeetraina/hellowhale to see how I built up this webpage in detail.

Building up Docker Swarm Cluster

Docker Swarm Mode is supported on Docker Desktop for Windows Platform. Let us first initiate Docker Swarm Mode and see how WordPress application can be deployed on this cluster.

PS C:\Users\Ajeet_Raina\docker101\play-with-docker\wordpress> docker swarm init
Swarm initialized: current node (29g3oqgz89f9g7gyicgq8h1o2) is now a manager.

To add a worker to this swarm, run the following command:

    docker swarm join --token SWMTKN-1-1gz58w1cgci63er4dhl6rkhhg29umkkt373ic85hpb3ywvtvqg-4ersf0a9dz00ime4xy

To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

PS C:\Users\Ajeet_Raina\docker101\play-with-docker\wordpress>

Verifying Single Node Cluster

PS C:\Users\Ajeet_Raina\docker101\play-with-docker\wordpress> docker node ls
ID                            HOSTNAME                STATUS              AVAILABILITY        MANAGER STATUS      ENGINE
29g3oqgz89f9g7gyicgq8h1o2 *   linuxkit-00155d1fffe2   Ready               Active              Leader              18.09.

Running Docker Swarm Visualizer

Let us try running Swarm Visualizer for Docker Swarm by using the below docker-compose file:

version: "3"

    image: dockersamples/visualizer:stable
      - "8080:8080"
    stop_grace_period: 1m30s
      - "/var/run/docker.sock:/var/run/docker.sock"
        constraints: [node.role == manager]

All you need is to run the “docker-compose up -d” command to bring up visualizer tool as shown below:

Running WordPress Application on Docker Desktop running Swarm Mode Cluster

Let us first stop the last 2 containers which listen on port 80 and 81 and then follow the below command to bring up WordPress App.

Go ahead and clone the repository for “stack.yml” file under https://github.com/collabnix/dockerlabs/blob/master/beginners/install/windows/docker-desktop-for-windows/wordpress/stack.yml

Run the below command to bring up WordPress Application on Docker Swarm Mode Cluster.

PS C:\Users\Ajeet_Raina\docker101\play-with-docker\wordpress\example1> docker stack deploy --orchestrator=swarm -c stack.yml myapp10
.yml myapp10
Ignoring unsupported options: restart

Creating network myapp10_default
Creating service myapp10_db
Creating service myapp10_wordpress
PS C:\Users\Ajeet_Raina\docker101\play-with-docker\wordpress\example1>

Verifying the Stack

PS C:\Users\Ajeet_Raina\docker101\play-with-docker\wordpress\example1> docker stack --orchestrator=swarm ls
NAME                SERVICES            ORCHESTRATOR
myapp10             2                   Swarm
PS C:\Users\Ajeet_Raina\docker101\play-with-docker\wordpress\example1>

Hence, you can bring up Linux based WordPress application in just 1 minute.

Setting up Elastic Stack on Docker Desktop

We need to perform few of configuration changes related to Docker for Windows before we proceed with setting up ELK stack. First we need to enable share drives for ELK stack to work. Docker for Windows provides you a simplified approach to enable this feature. Click on Whale Icon > Shared Drives > Select “C:” local drive which will be made available to your Docker containers which run ELK Stack.

Once you select and click on “Apply” it will restart Docker as well as Kubernetes(if enabled earlier). This should be good enough for OpenUSM to work smoothly.

Cloning the ELK Repository

git clone https://github.com/collabnix/openusm

cd openusm/logging/

Setting up ELK Stack

Docker for Windows is a development platform and comes with docker-compose installed by default. All you need is to run the below command to bring up ELK stack… Awesome, Isn’t it?

docker-compose up -d

You can verify if ELK has come up or not by running the below command as shown:

Open up to access Kibana UI as shown below:

Hope you found this blog really helpful. In my future posts, I will demonstrate 5 cool Windows based applications running on Docker Desktop Platform.