---
title: "Run Linux containers on Windows\n    | Ubuntu"
description: Ubuntu is an open source software operating system that runs from the
  desktop, to the cloud, to all your internet connected things.
url: https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers?format=md
keywords: index, follow
---

# Run Linux containers on Windows

1. [Overview](https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers?format=md#1-overview)
2. [Requirements](https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers?format=md#2-requirements)
3. [Install Docker for Windows](https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers?format=md#3-install-docker-for-windows)
4. [Download the Ubuntu container image](https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers?format=md#4-download-the-ubuntu-container-image)
5. [Prepare the container environment](https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers?format=md#5-prepare-the-container-environment)
6. [More Docker preparation](https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers?format=md#6-more-docker-preparation)
7. [Run an Ubuntu container on Hyper-V](https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers?format=md#7-run-an-ubuntu-container-on-hyperv)
8. [Getting help](https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers?format=md#8-getting-help)

## 1. Overview

It is now possible to run Docker containers on Windows 10 and Windows Server, leveraging Ubuntu as a hosting base.

Imagine running your own Linux applications on Windows, using a Linux distribution you are comfortable with: Ubuntu!

It is now possible to do so using the power of Docker technology and Hyper-V virtualization on Windows.

*Originally authored by Mathieu Trudel-Lapierre.*

---

[Suggest changes ›](https://discourse.ubuntu.com/t/run-linux-containers-on-windows/13980)

about
19
minutes to go

*Previous step*
[*Next step*](https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers?format=md#2-requirements)

## 2. Requirements

You will need a 64-bit x86 PC with 8GiB of RAM running Windows 10 or Windows Server, updated to include the [Windows 10 Fall Creator update](https://support.microsoft.com/en-gb/help/4028685/windows-10-get-the-fall-creators-update), released October 2017.

You will also need a recent [installation of Docker](https://docs.docker.com/install/).

Finally, you will need to make sure you have installed a program for decompressing the Ubuntu host container image, e.g. [7-Zip](http://7-zip.org/) or [XZ Utils](https://tukaani.org/xz/)

---

[Suggest changes ›](https://discourse.ubuntu.com/t/run-linux-containers-on-windows/13980)

about
14
minutes to go

[*Previous step*](https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers?format=md#1-overview)
[*Next step*](https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers?format=md#3-install-docker-for-windows)

## 3. Install Docker for Windows

Download Docker for Windows from [Docker Store](https://store.docker.com/editions/community/docker-ce-desktop-windows).

Once downloaded, proceed with the installation steps, and either logout or reboot of your system as indicated by the installer.

After reboot, Docker will be started. Docker requires that the Hyper-V feature is enabled, so if necessary will ask you to enable it and restart. Click *OK* for Docker to enable Hyper-V and restart your system.

---

[Suggest changes ›](https://discourse.ubuntu.com/t/run-linux-containers-on-windows/13980)

about
12
minutes to go

[*Previous step*](https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers?format=md#2-requirements)
[*Next step*](https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers?format=md#4-download-the-ubuntu-container-image)

## 4. Download the Ubuntu container image

Download the latest Ubuntu container image for Windows from the [Canonical Partner Images website](https://partner-images.canonical.com/hyper-v/linux-containers/)

Once downloaded, extract the image, using e.g. 7-Zip, or XZ Utils:

```
C:\Users\mathi\> .\xz.exe -d xenial-container-hyper-v.vhdx.xz
```

---

[Suggest changes ›](https://discourse.ubuntu.com/t/run-linux-containers-on-windows/13980)

about
8
minutes to go

[*Previous step*](https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers?format=md#3-install-docker-for-windows)
[*Next step*](https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers?format=md#5-prepare-the-container-environment)

## 5. Prepare the container environment

First, create two directories:

Create *C:\lcow*, which will be used as scratch space for Docker while preparing the containers.

Also create *C:\Program Files\Linux Containers*. This is where the Ubuntu container image will live.

You will need to give this folder extra permissions to allow Docker to use the images from it. Run the following Powershell script in an administrator Powershell window:

```
param(
[string] $Root
)
# Give the virtual machines group full control
$acl = Get-Acl -Path $Root
$vmGroupRule = new-object System.Security.AccessControl.FileSystemAccessRule("NT VIRTUAL MACHINE\Virtual Machines", "FullControl","ContainerInherit,ObjectInherit", "None", "Allow")
$acl.SetAccessRule($vmGroupRule)
Set-Acl -AclObject $acl -Path $Root
```

Save this file as *set\_perms.ps1* and run it:

**TIP** You may need to run ‘Set-ExecutionPolicy -Scope process unrestricted’ to be allowed to run unsigned Powershell scripts.

```
C:\Users\mathi\> .\set_perms.ps1 "C:\Program Files\Linux Containers"
C:\Users\mathi\>
```

Now, copy the Ubuntu container image *.vhdx* file that was decompressed at the previous step to *uvm.vhdx* under *C:\Program Files\Linux Containers*.

---

[Suggest changes ›](https://discourse.ubuntu.com/t/run-linux-containers-on-windows/13980)

about
6
minutes to go

[*Previous step*](https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers?format=md#4-download-the-ubuntu-container-image)
[*Next step*](https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers?format=md#6-more-docker-preparation)

## 6. More Docker preparation

Docker for Windows requires some pre-release features in order to work with Hyper-V isolation. While these features are not yet available in the Docker CE installation that was done previously, the necessary files can be downloaded from [master.dockerproject.org](https://master.dockerproject.org).

Retrieve *dockerd.exe* and *docker.exe* from [master.dockerproject.org](https://master.dockerproject.org), and put the two programs somewhere safe, such as in your own folder. They will be used to start the Ubuntu container in the next step.

---

[Suggest changes ›](https://discourse.ubuntu.com/t/run-linux-containers-on-windows/13980)

about
4
minutes to go

[*Previous step*](https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers?format=md#5-prepare-the-container-environment)
[*Next step*](https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers?format=md#7-run-an-ubuntu-container-on-hyperv)

## 7. Run an Ubuntu container on Hyper-V

You’re now ready to start your container. First, open a Command-line prompt (*cmd.exe*) as Administrator, and start *dockerd.exe* with the right environment:

```
C:\Users\mathi\> set LCOW_SUPPORTED=1
C:\Users\mathi\> .\dockerd.exe -D --data-root C:\lcow
```

**Docker already running?**
If the Docker installer sets Docker to run automatically at boot, you may need to quit the already running daemon, via its toolbar icon, before running the above commands.

Then, start a Powershell window as Administrator; and run *docker.exe*, instructing it to pull the image for your container:

```
C:\Users\mathi\> .\docker.exe pull ubuntu
```

We can now finally start the container. Run *docker.exe* again, and tell it to run the new image:

```
C:\Users\mathi\> .\docker.exe run -it ubuntu
```

Congratulations! You have successfully set up your system to use containers with Hyper-V isolation on Windows, and have run your very own Ubuntu container.

---

[Suggest changes ›](https://discourse.ubuntu.com/t/run-linux-containers-on-windows/13980)

about
1
minutes to go

[*Previous step*](https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers?format=md#6-more-docker-preparation)
[*Next step*](https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers?format=md#8-getting-help)

## 8. Getting help

If you need some guidance getting started with the Ubuntu container images for Hyper-V, or if you get stuck, help is always at hand:

* [Ask Ubuntu](https://askubuntu.com/)
* [Ubuntu Forums](https://ubuntuforums.org/)
* [IRC-based support](https://wiki.ubuntu.com/IRC/ChannelList)

Was this tutorial useful?

---

[Suggest changes ›](https://discourse.ubuntu.com/t/run-linux-containers-on-windows/13980)

about
0
minutes to go

[*Previous step*](https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers?format=md#7-run-an-ubuntu-container-on-hyperv)

*Next step*
