This guide is based off of Setting Up Docker for Windows and WSL to Work Flawlessly
Install Docker for Windows
This will disable VirtualBox when you enable Hyper-V
# Update the apt package list.
sudo apt-get update -y
# Install Docker's package dependencies.
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
# Download and add Docker's official public PGP key.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# Verify the fingerprint.
sudo apt-key fingerprint 0EBFCD88
# Add the `stable` channel's Docker upstream repository.
#
# If you want to live on the edge, you can change "stable" below to "test" or
# "nightly". I highly recommend sticking with stable!
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
# Update the apt package list (for the new apt repo).
sudo apt-get update -y
# Install the latest version of Docker CE.
sudo apt-get install -y docker-ce
# Allow your user to access the Docker CLI without needing root access.
sudo usermod -aG docker $USER# Install Python and PIP.
sudo apt-get install -y python python-pip
# Install Docker Compose into your user's home directory.
pip install --user docker-composeTurn on "Expose Daemon on tcp://localhost:2375 without TLS" in Docker Desktop(Windows)
Setup WSL Docker to connect to the windows daemon
echo "export DOCKER_HOST=tcp://localhost:2375" >> ~/.bashrc && source ~/.bashrc# You should get a bunch of output about your Docker daemon.
# If you get a permission denied error, close + open your terminal and try again.
docker info
# You should get back your Docker Compose version.
docker-compose --versionOPTIONAL - Upgrade to Ubuntu 18.04 - I can only confirm that this works on 18.04, My guess is 16.04 works fine.
# Install release upgrader
sudo apt install ubuntu-release-upgrader-core -y
# Upgrade! (20-30 min wait time)
sudo do-release-upgrade -d
We need to set root = / because this will make your drives mounted at /c or /e instead of /mnt/c or /mnt/e.
The options = "metadata" line is not necessary but it will fix folder and file permissions on WSL mounts so everything isn’t 777 all the time within the WSL mounts. I highly recommend you do this!
sudo vi /etc/wsl.conf
# Now make it look like this and save the file when you're done:
[automount]
root = /
options = "metadata"After making this change sign out of your computer so it will recognize the changes.
If you try to enable the C: for sharing at this moment it will most likely give you a firewall error.
Open PowerShell as Administrator then run:
Set-NetConnectionProfile -interfacealias "vEthernet (DockerNAT)" -NetworkCategory PrivateGo to your network settings:
Win + X
Select "Network Connections" -> "Network and Sharing Center" -> "Change Adapter Settings"
Select "vEthernet (DockerNAT)" -> Properties
Unselect File and Printer Sharing and press OK then open the properties again and turn it back on. (windows magic ensues)
Go to Docker Desktop and share your C:
HOOORAY it should work, otherwise book off the next couple hours
Restart your docker daemon through Docker Desktop
This means your mount of C: was unsuccessful, check your root directory to see if C exists. If C: exists be sure it is shared in Docker Desktop.