DEV Community

Arjun Shetty
Arjun Shetty

Posted on

2 1

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

👋 While you are here

Reinvent your career. Join DEV.

It takes one minute and is worth it for your career.

Get started

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay