Docker is pretty cool, but there’s one thing that always gets in the way for me.
The default installer sucks.
Installing Docker using the Windows version of the Docker Toolkit means it installs multiple things on your computer:
- The Docker command-line tools (hooray)
- Virtual Box (boo)
- Kitematic, a user interface (only works with Virtual Box… so also boo?)
As I use Hyper-V as my virtualization platform of choice, Virtual Box is completely redundant. More than that, it’s an annoyance. They’re incompatible with each other.
Obviously this was no good for me, so after a bit of messing around I have found my preferred method for getting Docker up and running on own workstations using Hyper-V.
As is always the case with these things, this may not be the best way for everyone. But if you’re interested, here’s what I did:
Note: the following assumes you have some knowledge of Windows and PowerShell in order to keep the instructions brief.
- Ensure you have Windows 8.1 or 10 Professional
- Ensure you have Hyper-V installed
- Create an external switch called “External Switch” (if you don’t have one)
Get the binaries
docker.execlient from: https://github.com/docker/docker/releases
- Put them in a new
Update your PowerShell profile.ps1 file
Make sure you can get to your new commands by using an alias or add the folder to your PATH, either works:
Set-Alias docker "~\Scripts\Docker\docker.exe" Set-Alias docker-machine "~\Scripts\Docker\docker-machine.exe"
And then add some variables to be used by default, like the network switch and memory allocation:
$env:HYPERV_VIRTUAL_SWITCH = "External Switch" $env:HYPERV_MEMORY = 2048
Create and configure your machine
After this you should be able to create a new boot2docker VM on Hyper-V:
PS> docker-machine create -d hyperv default
Once that’s up and running you’ll need to set your environment for the Docker client:
PS> docker-machine env --shell=powershell default | invoke-expression
Try out a container
Working? Great! Try running something, like the new .NET Core container:
PS> docker run -it microsoft/dotnet:latest
Looks like there will be an even easier way to do this moving forward, thanks to an upcoming release of Docker for Windows which will use Hyper-V by default. (Yesssss!!!)
Find out more through this handy article from Scott Hanselman.