Docker In Windows 10 Home
- How To Install Docker On Windows 10 Home Edition
- Run Docker In Windows 10 Home
- How To Run Docker On Windows 10 Home
In Windows 10 home, docker desktop creates the VM under 'C: Users xxx AppData Local Docker' directory and it is this VM that contains the downloaded docker images. If you want to change the VM location from C: to a different directory you can do this by creating a junction on windows (prior to docker desktop installation) using a command like. It'll take 5-10 minutes tops if your Windows 10 is somewhat up to date. How to install WSL on Windows 10. WSL doesn't include a Linux kernel. Its Linux file system access is kinda slow, but it accesses Windows files super fast. If you use Cygwin, you'll love this, because it's really Linux, just the kernel is emulated. How to install WSL2 on. With Windows 10 introducing WSL2 you can now run Docker image from Ubuntu running via WSL2 that’s connected to your Host’s Docker Desktop app. That’s just insane! It’s inception in OS level. Today we will take a look at how to turn on this integration, so you can run Docker inside Ubuntu that’s running inside Windows 10 via WSL2. Installing Docker on Windows 10 Home edition is like trying to put a square peg in a round hole with your hands tied behind your back, during a hail storm while running away from a bipolar.
I've written about WSL2 and it's glorious wonders many times. As its release (presumably) grows closer - as of this writing it's on Windows Insiders Slow and Fast - I wanted to update a few posts. I've blogged about a few cool thing around WSL and Docker
Here's a little HanselFAQ and some resources.
I want to run Linux on Windows
You can certainly use HyperV or VirtualBox and run a standard Virtual Machine. Download an ISO and mount it and run 'a square within a square.' It won't be seamlessly integrated within Windows - it'll be like the movie Inception - but it's time-tested.
Better yet, install WSL or WSL2. It'll take 5-10 minutes tops if your Windows 10 is somewhat up to date.
- How to install WSL on Windows 10
- WSL doesn't include a Linux kernel. Its Linux file system access is kinda slow, but it accesses Windows files super fast. If you use Cygwin, you'll love this, because it's really Linux, just the kernel is emulated.
- How to install WSL2 on Windows 10
- WSL2 ships an actual Linux kernel and its Linux file system is 5x-10x faster than WSL. WSL2 uses a tiny utility VM that expands contracts its memory and you can manage distros with the wsl command line.
- Do all your development work inside here, while still using VS Code on Windows. It's amazing. Watch me set up a friend with WSL2, LIVE on YouTube.
I want to SSH into Linux stuff from Windows
There's 15 years of websites telling you to install Putty but you might not need it. OpenSSH has been shipping in Windows 10 for over two years. You can add them with Windows Features, or if you like, grab a release and put it on your PATH.
You can also do things like set up keys to use Windows 10's built-in OpenSSH to automatically SSH into a remote Linux machine. I also like to setup Signed Git Commits with a YubiKey NEO and GPG and Keybase on Windows.
I need a better Terminal in Windows
The new Windows Terminal is for you. Download Windows Terminal now for free. It's open source. You can then run the Win64/Win32 ssh from above, or run any Linux distros SSH. Have fun. It's time.
NOTE: Have you already downloaded the Terminal, maybe a while back? Enough has changed that you should delete your profiles.json and start over.
You can download the Windows Terminal from the Microsoft Store or from the GitHub releases page. There's also an unofficial Chocolatey release. I recommend the Store version if possible.
My prompt and fonts are ugly
Make them pretty. You deserve the best. Go get Cascadia Code's CascadiaPL.ttf and PowerLine and buckle up buttercup. Get a nice theme and maybe a GIF background.
I want to use Docker on Windows and I want it to not suck
Surprise, it's actually awesome. You may have had some challenges with Docker a few years ago on Windows and gave up, but come back. There's been a huge (and fascinating) architecture of Docker on Windows. It's very nicely integrated if you have WSL2.
If you have WSL2 set up nicely, then get Docker Desktop WSL2. This version of Docker for Windows uses WSL2 as its engine allowing you to share your docker context across Windows and Linux on the same machine! As the maker intended!
WSL 2 introduces a significant architectural change as it is a full Linux kernel built by Microsoft, allowing Linux containers to run natively without emulation. With Docker Desktop running on WSL 2, users can leverage Linux workspaces and avoid having to maintain both Linux and Windows build scripts.
So that means
- Install Windows 10 Insider Preview build 19018 or higher
- Enable WSL 2 feature on Windows. For detailed instructions, refer to the Microsoft documentation.
- Download Docker Desktop Edge 2.1.6.0 or a later release.
Ensure your default WSL instances is WSL2. You can do that with wsl -l -v
, and then wsl --set-version <distro> 2
Then within Docker Desktop for Windows you've got two things to check. First, are you using WSL2 as your backend?
And then, the often missed setup, check under Resources | WSL Integration and tell Docker which WSL2 distros you want to use to access Docker. If you're paying attention you may notice that Docker Desktop tries to prompt you with a notification in Action Center but you might miss it.
NOTE: If you used an early Tech Preview, you might have an extra now-vestigial Docker context named 'wsl.' You want to use the Default one, not the WSL one.
This isn't intuitive or obvious and you might get weird errors like these
or
You can see if you have an extra context from before like below. That 'wsl' one is older (if you have it) and you want to use default in both Windows and WSL2.
I actually removed that one to avoid confusion with docker context rm wsl
.
Here's Ubuntu on my Windows machine
And here's my Windows machine. Note that docker images in both instances returns the same list. They are the same Docker backend!
I want to code in VS Code on Windows but compile on Linux
At this point once I've set things up I can go bananas. I can do Container-based development, where I use VS Code to run all my developer tools and builds insider a container...maybe I never event install Go or PHP or .NET Core. It's all just inside a container.
Oh, by the way, please Subscribe to my YouTube! I talk a lot about this stuff over there.
Sponsor: Couchbase gives developers the power of SQL with the flexibility of JSON. Start using it today for free with technologies including Kubernetes, Java, .NET, JavaScript, Go, and Python.
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
AboutNewsletter
Last year we announced that Docker had released a preview of Docker Desktop with WSL 2 integration. We are now pleased to announce that we have completed the work to enable experimental support for Windows Home WSL 2 integration. This means that Windows Insider users on 19040 or higher can now install and use Docker Desktop!
Feedback on this first version of Docker Desktop for Windows Home is welcomed! To get started, you will need to be on Windows Insider Preview build 19040 or higher and install the Docker Desktop Edge 2.2.2.0.
What’s in Docker Desktop for Windows Home?
Docker Desktop for WSL 2 Windows Home is a full version of Docker Desktop for Linux container development. It comes with the same feature set as our existing Docker Desktop WSL 2 backend. This gives you:
- Latest version of Docker on your Windows machine
- Install Kubernetes in one click on Windows Home
- Integrated UI to view/manage your running containers
- Start Docker Desktop in <5 seconds
- Use Linux Workspaces
- Dynamic resource/memory allocation
- Networking stack, support for http proxy settings, and trusted CA synchronization
How do I get started developing with Docker Desktop?
For the best experience of developing with Docker and WSL 2, we suggest having your code inside a Linux distribution. This improves the file system performance and thanks to products like VSCode mean you can still do all of your work inside the Windows UI and in an IDE you know and love.
Firstly make sure you are on the Windows insider program, are on 19040 and have installed Docker Desktop Edge.
Next install a WSL distribution of Linux (for this example I will assume something like Ubuntu from the Microsoft store).
You may want to check your distro is set to V2, to check in powershell run
How To Install Docker On Windows 10 Home Edition
wsl -l -v
If you see your distro is a version one you will need to run
wsl ‐‐set-version DistroName 2
Once you have a V2 WSL distro, Docker Desktop will automatically set this up with Docker.
The next step is to start working with your code inside this Ubuntu distro and ideally with your IDE still in Windows. In VSCode this is pretty straightforward.
You will want to open up VSCode and install the Remote WSL extension, this will allow you to work with a remote server in the Linux distro and your IDE client still on Windows.
Now we need to get started working in VSCode remotely, the easiest way to do this is to open up your terminal and type:
Wsl
code .
This will open a new VSCode connected remotely to your default distro which you can check in the bottom corner of the screen.
Run Docker In Windows 10 Home
(or you can just look for Ubuntu in your start menu, open it and then run code .
)
How To Run Docker On Windows 10 Home
Once in VSCode there I use the terminal in VSCode to pull my code and start working natively in Linux with Docker from my Windows Home Machine!
Other tips and tricks:
- If you want to get the best out of the file system performance avoid mounting from the windows file system (even from a WSL distro. eg:
avoid docker run -v /mnt/c/users:/users
) - If you are worried about the size of the docker-desktop-data VHDX or need to change it you can do this through the WSL tooling built into Windows:
https://docs.microsoft.com/en-us/windows/wsl/wsl2-ux-changes#understanding-wsl-2-uses-a-vhd-and-what-to-do-if-you-reach-its-max-size - If you are worried about CPU/Memory usage you put limits on memory/cpu/swap size on the WSL2 utility VM https://docs.microsoft.com/en-us/windows/wsl/release-notes#build-18945
Your feedback needed!
We are excited to get your feedback on the first version of Docker Desktop for Windows Home and for you to tell us how we can make it even better.
To get started with WSL 2 Docker Desktop on Windows home today you will need to be on Windows Insider Preview build 19040 or higher and install the Docker Desktop Edge 2.2.2.0.