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

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs