Get Docker on Windows – Docker Toolbox

How to get Docker installed in your windows? First major consideration is the version of Windows that you are running.

Docker for Windows: Docker for Windows requires 64 bit Windows 10 Pro or Windows Server 2016 and Microsoft Hyper-V. You can find complete requirements here

Docker Toolbox : If your windows does not meet the above requirements, you can install Docker Toolbox, which uses Oracle Virtual Box

Let us look at Docker toolbox installation in detail for those who are on Windows 8 or Windows 7. Make sure that virtualization is supported/enabled in your OS. For Windows 8, verify that from Task Manager -> Performance Tab.

docker_windows_installation2

For windows 7, download and run the Hardware-Assisted Virtualization Detection Tool

docker_windows_installation1

Next install Docker Toolbox (with default options selected) and launch Docker Terminal

docker_windows_installation3

Verify installation by running hello-world command

$ docker run hello-world

docker_windows_installation4

Launch Kitematic to search for various docker images available from Docker Hub

docker_windows_installation5

 

Docker Integration for Visual Studio Developers

Containerization using Docker

As implementation of solutions based on micro services and containerization are growing like never before, it is important for us to weigh the advantages.  As we know, Docker in this area has gone way ahead of others. Even though it evolved as a container solution based on Linux, of late native support for Docker has been released in Windows Server 2016 and Windows 10 OS.

Docker for Visual Studio Developers

dockerVSfeature

Support for Docker is available in Visual Studio 2017. To build, run and debug your applications from VS in Docker container, you should install Docker for Windows (https://docs.docker.com/docker-for-windows/install/) installed on your PC in addition to Visual Studio 2017.

Once installed, you can specify the option as below to enable Docker support while creating your project. Alternately you can right click on the particular project in solution explorer and use Add->Docker Support.

Docker

Visual studio integration adds the following files to your project

  • Dockerfile – build instructions for the image

Compose Files (to define and run multi-container applications with Docker)

  • Docker-compose.yml
  • Docker-compose.dev.debug.yml
  • Docker-compose.dev.release.yml

The docker-compose.yml file contains the name of the image that is created when project is run

version: '2'
services:
 ci-build:
 image: microsoft/aspnetcore-build:1.1.0-msbuild
 volumes:
 - .:/src
 working_dir: /src
 command: /bin/bash -c "dotnet restore && dotnet publish -c Release -o ./bin/Release/PublishOutput"

Sample Dockerfile

FROM microsoft/aspnetcore:1.1
ARG source
WORKDIR /app
EXPOSE 80
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "MyDockerApplication.dll"]