HPE Storage Tech Insiders
cancel
Showing results for 
Search instead for 
Did you mean: 

Tech Preview: Windows Containers Docker Volume plugin

mmattsson

In recent years Microsoft has gone through a transformation to attract more developers to their ecosystems. Native Linux binaries in a Ubuntu sandbox, open sourcing PowerShell, a free cross-platform source code editor, Visual Studio Code. A year ago the concept of Windows Containers were quite foreign. But here they are, in all it’s glory, with the full unambiguous Docker experience. Nimble continues to invest in our Microsoft relationship and we're the first Microsoft and Docker ecosystem partner to provide a Docker Volume plugin for Windows Containers.

By example: Minio

Getting into the driver seat as a developer to understand how to build, ship and run a Windows application inside a Windows Container, I wanted to explore each step. Minio is an AWS S3 compatible object storage server written in Go and already there’s an official Go image built from microsoft/nanoserver and microsoft/windowsservercore. It doesn’t have git installed so I need to add git to be able to pull down the Minio source code and build it.

Please find Dockerfile and Docker Compose file attached at the bottom!

Dockerfile

FROM golang:nanoserver

MAINTAINER michael.mattsson@nimblestorage.com

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]


ENV MINIO_BRANCH release

ENV GIT_VERSION 2.12.0

ENV GIT_RELEASE v${GIT_VERSION}.windows.1

ENV GIT_ZIP MinGit-${GIT_VERSION}-64-bit.zip

ENV GIT_URL https://github.com/git-for-windows/git/releases/download/${GIT_RELEASE}/${GIT_ZIP}

RUN New-Item -Path C:\Minio -Type Directory; \

    Invoke-WebRequest $env:GIT_URL -OutFile git.zip; \

    Expand-Archive git.zip -Destinationpath C:\git; \

    Remove-Item git.zip; \

    $env:PATH = 'C:\Minio;C:\git\cmd;C:\git\mingw64\bin;C:\git\usr\bin;' + $env:PATH; \

    Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH; \

    New-Item C:\gopath\src\github.com\minio -Type Directory; \

    cd C:\gopath\src\github.com\minio; \

    git clone -b $env:MINIO_BRANCH https://github.com/minio/minio; \

    cd minio; \

    git submodule update --init --recursive; \

    go build; \

    Copy-Item minio.exe /Minio; \

    cd \; \

    Remove-Item C:\gopath\src -Recurse -Force

EXPOSE 9000

ENTRYPOINT ["minio.exe"]

So far, not much have changed. All the standard verbs are there, slashes go the wrong way and I can admit I learned some PowerShell in the process. Building and running your application is much simpler with Docker Compose. I simply copied one of my example Docker Compose files I had for running Minio on Linux. With very little modification I could bring up the application and serve from a Nimble volume.

docker-compose.yml

version: '3'

services:

  minio:

    build: .\minio

    ports:

      - "9000:9000"

    volumes:

      - export:C:\Export

    environment:

      MINIO_ACCESS_KEY: nimble

      MINIO_SECRET_KEY: nimblestorage

    command: server C:\\Export\\Buckets

volumes:

  export:

    driver: nimble

    driver_opts:

      sizeInGiB: 1000

      perfPolicy: "Windows File Server"

      description: "Rolling my own AWS S3"

networks:

  default:

    external:

      name: nat

We’re now able to bring up the project:

docker-compose.exe up

PS C:\Users\mmattsson> docker-compose.exe up

Creating volume "dev_export" with nimble driver

Building minio

Step 1/11 : FROM golang:nanoserver

---> 2c8f2f11bd5a

Step 2/11 : MAINTAINER michael.mattsson@nimblestorage.com

---> Using cache

---> 3fe516998a09

Step 3/11 : SHELL powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';

---> Using cache

---> bf8a51e230ea

Step 4/11 : ENV MINIO_BRANCH release

---> Using cache

---> d20c97a62641

Step 5/11 : ENV GIT_VERSION 2.12.0

---> Using cache

---> c23f8f4b6020

Step 6/11 : ENV GIT_RELEASE v${GIT_VERSION}.windows.1

---> Using cache

---> 099fedfe35be

Step 7/11 : ENV GIT_ZIP MinGit-${GIT_VERSION}-64-bit.zip

---> Using cache

---> cd4074ad15e9

Step 8/11 : ENV GIT_URL https://github.com/git-for-windows/git/releases/download/${GIT_RELEASE}/${GIT_ZIP}

---> Using cache

---> e5411a4e0774

Step 9/11 : RUN New-Item -Path C:\Minio -Type Directory;    Invoke-WebRequest $env:GIT_URL -OutFile git.zip;    Expand-Archive git.zip -Destinationpath C:\git;    Remove-Item git.zip;    $env:PATH = 'C:\Minio;C:\git\cmd;C:\git\mingw64\bin;C:\git\usr\bin;' + $env:PATH;    Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH;    New-Item C:\gopath\src\github.com\minio -Type Directory;    cd C:\gopath\src\github.com\minio;    git clone -b $env:MINIO_BRANCH https://github.com/minio/minio;    cd minio;    git submodule update --init --recursive;    go build;    Copy-Item minio.exe /Minio;    cd \;    Remove-Item C:\gopath\src -Recurse -Force

---> Using cache

---> e95705a70bf1

Step 10/11 : EXPOSE 9000

---> Using cache

---> 4656141a2a56

Step 11/11 : ENTRYPOINT minio.exe

---> Using cache

---> b3e5f4a21ad4

Successfully built b3e5f4a21ad4

Image for service minio was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.

Creating dev_minio_1

Attaching to dev_minio_1

minio_1  | Created minio configuration file successfully at C:\Users\ContainerAdministrator\.minio

minio_1  |

minio_1  | Endpoint:  http://172.31.182.170:9000  http://127.0.0.1:9000

minio_1  | AccessKey: nimble

minio_1  | SecretKey: nimblestorage

minio_1  | Region:    us-east-1

minio_1  | SQS ARNs:  <none>

minio_1  |

minio_1  | Browser Access:

minio_1  |    http://172.31.182.170:9000  http://127.0.0.1:9000

minio_1  |

minio_1  | Command-line Access: https://docs.minio.io/docs/minio-client-quickstart-guide

minio_1  |    $ mc.exe config host add myminio http://172.31.182.170:9000 nimble nimblestorage

minio_1  |

minio_1  | Object API (Amazon S3 compatible):

minio_1  |    Go:        https://docs.minio.io/docs/golang-client-quickstart-guide

minio_1  |    Java:      https://docs.minio.io/docs/java-client-quickstart-guide

minio_1  |    Python:    https://docs.minio.io/docs/python-client-quickstart-guide

minio_1  |    JavaScript: https://docs.minio.io/docs/javascript-client-quickstart-guide

minio_1  |

minio_1  | Drive Capacity: 1000 GiB Free, 1000 GiB Total

This looks simple enough. Right? Getting to where Microsoft and Docker are today is no small feat. The full suite of Docker tools for Windows for developers to indulge. Nimble announced the Windows Container plugin at Microsoft Ignite last year and all parties have worked tirelessly on getting this technology out the door.

These are the capabilities that are expected at release:

Nimble Storage Windows Container plugin

PS C:\Users\mmattsson> docker volume create -d nimble -o help

Error response from daemon: create 6e9565253704c51483726f03609c47519e3844fe3a5d4424b530450ebe88aa3e:

Nimble Storage Docker Volume Driver: Create Help

Create or Clone a Nimble Storage backed Docker Volume or Import an existing Nimble Volume or Clone of a Snapshot into Do

cker.

Create options:

  -o sizeInGiB=X                  X is the size of volume specified in GiB

  -o size=X                        X is the size of volume specified in GiB (short form of sizeInGiB)

  -o description=X                X is the text to be added to volume description (optional)

  -o perfPolicy=X                  X is the name of the performance policy (optional)

                                  Performance Policies: Exchange 2003 data store, Exchange 2007 data store, Exchange log, SQL Server, SharePoint, Exchange 2010 data store, SQL Server Logs, SQL Server 2012, Oracle OLTP, Windows File Server, Other Workloads, DockerDefault

  -o pool=X                        X is the name of pool in which to place the volume (optional)

  -o folder=X                      X is the name of folder in which to place the volume (optional)

  -o encryption                    indicates that the volume should be encrypted (optional, dedupe and encryption are mutually exclusive)

  -o thick                        indicates that the volume should be thick provisioned (optional, dedupe and thick are mutually exclusive)

  -o dedupe                        indicates that the volume should be deduplicated (optional, requires perfPolicy option to be set)

Docker Volume Clone options:

  -o cloneOf=X                    X is the name of Docker Volume to create a clone of

Import Nimble Volume options:

  -o importVol=X                  X is the name of the Nimble Volume to import

  -o pool=X                        X is the name of pool in which to place the volume (optional)

  -o folder=X                      X is the name of folder in which to place the volume (optional)

  -o forceImport                  forces the import of the volume.  Note that overwrites application metadata (optional)

Import Nimble Volume as Clone options:

  -o importVolAsClone=X            X is the name of the Nimble Volume to clone

  -o snapshot=X                    X is the name of the snapshot to clone from & is applicable when importVolAsClone option is specified. (optional, latest snapshot of volume is used if not specified)

  -o pool=X                        X is the name of pool in which to place the volume (optional)

  -o folder=X                      X is the name of folder in which to place the volume (optional)

Yes, the capabilities of cloning and importing Nimble volumes are all there at the Windows Container DevOps engineer to reap the benefits of.

Please come see us at DockerCon ’17 in Austin, TX in a few weeks. We’ll be demoing Windows Containers amongst a slew of other cool things Nimble enable you to do in your container environments.

Useful links on Windows Containers

Build and run your first Docker Windows Server container: https://blog.docker.com/2016/09/build-your-first-docker-windows-server-container

Docker Captain Stefan Scherer’s blog: https://stefanscherer.github.io/ (endless useful information on Windows Containers)

Windows Container on Windows Server: https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/quick-start-windows-server

--

About the Author

mmattsson

Data & Storage Nerd, Containers, DevOps, IT Automation

Events
See posts for
dates/locations
HPE at 2018 Technology Events
Learn about the technology events where Hewlett Packard Enterprise will have a presence in 2018.
Read more
See posts for dates/locations
Reimagine 2018
Join us at one of the Reimagine 2018 stops and see how we Simplify Hybrid IT, innovate at the Intelligent Edge and bring it all together with HPE Poin...
Read more
View all