DEV Community

Arjun Shetty
Arjun Shetty

Posted on

setting up docker with Hyper-V

Docker is just amazing with flexibility we get to not worry about setting up the environments for our application.

Image

--Photo by frank mckenna on Unsplash

Download docker for windows.

So with Windows we can use hyper-V and get containers spawned in minutes.

Here is how we do it.

Make sure you have Hyper-V enabled on windows if not go to turn on windows feature and turn this feature On. Once this is done with restart.

Use Hyper-V Manager for Windows to create a Virtual Switch

Image

Now use the following commands to create the docker containers

docker-machine create -d hyperv --hyperv-virtual-switch "Primary Virtual Switch" default

this will create a VM, you can see this with Hyper-V manager or

docker-machine ls

once the machine is created you need to set some of the machine details in Environments Variables

to list the variables use

docker-machine env default

Now set the env vairables as below using bash

eval $("C:\Users<username>\bin\docker-machine.exe" env default --shell bash)

No go ahead an use an existing docker images to test

docker run -it hello-world

docker run -it supertest2014/nyan

** CTRL + C is come out of it

Top comments (0)