I added this article to my Docker Combat Guide book.
The change of license of Docker Desktop for Windows has been a low punch, a dirty one.
Many big companies use Windows as for the laptops and workstations, we like it or not.
You can setup a Linux development computer or Virtual Machine, you may argue, but things are not as easier.
Big companies have Software licenses assigned to corporation machines, so you may not use your Pycharm license in a Linux VM.
You may no use Docker Desktop either, if your company did not license it.
And finally you may need to have access to internal resources, like Artifactory, or Servers where access is granted via ACL, so only you, from your Development machine can access it. So you have to be able to run Docker locally.
After Docker introduced this changed of license I was using VirtualBox with NAT attached to the VPN Virtual Ethernet, and I port forwarded to be able to SSH, deploy, test, etc… from outside to my Linux VM, and it was working for a while, until with the last VirtualBox update and some Windows updates where pushed to my Windows box and my VirtualBox VMs stopped booting most of the times and having random problems.
I configured a new Linux VM in a Development Server, and I opened Docker API so my Pycharm’s workstation was able to deploy there and I was able to test. But the Dev Ip’s do not have access to the same Test Servers I need my Python Automation projects to reach (and quickly I used 50 GB of space), so I tried WSL. I like Pycharm I didn’t want to switch to VStudio Code because of their good Docker extensions, in any case I could not run my code locally with venv cause some of the packages where not available for Windows, so I needed Linux to run the Unit Testing and see the Code Coverage, run the code, etc…
I tried Hyper-V, tried with NAT External, but it was incompatible with my VPN.
Note: WSL can be used, but I wanted to use Docker Engine, not docker in WSL.
Installing Docker Command line binaries
The first thing I checked was the Docker downloads page.
I found the stand alone binary.
https://docs.docker.com/engine/install/binaries/#install-server-and-client-binaries-on-windows
In order to install it:
- Download the zip file from the page, in my case docker-20.10.12.zip
- Open PowerShell as Administrator
- Run: Expand-Archive C:\Users\carlesmateo\Downloads\docker-20.10.12.zip -DestinationPath $Env:ProgramFiles\DockerCLI
- Run: cd $Env:ProgramFiles\DockerCLI\docker
- Run: .\dockerd.exe –register-service
- Run: Start-Service docker
- Check that Docker lists the running Containers (no errors) with: docker ps
- Check that the Service is running with: Get-Service docker
You should expect something like:
Status Name DisplayName
------ ---- -----------
Running docker Docker Engine
Attempt to pull an Image with: docker pull ubuntu or docker pull php
If it works, you’re done, but most probably you will get it starting and get this error:
Error response from daemon: unsupported os linux
or this other error:
no matching manifest for windows/amd64 10.0.19042 in the manifest list entries
Depending on your system you may need to do certain things:
Turn Windows features on or off
I would make sure that are enabled:
- Containers
- Hyper-V
- Virtual Machine Platform
- Windows Hypervisor Platform
Press OK, and restart your computer.
Try Again to docker pull ubuntu
Enable Experimental Mode
Edit this file to enable experimental, you can run from the PowerShell:
notepad C:\ProgramData\Docker\config\daemon.json
Save the file and restart the Service:
Restart-Service docker
Check if it works
Get-Service docker
Status Name DisplayName ------ ---- ----------- Running docker Docker Engine
Try if now it works.
Switch Daemon
If it is not working, try running:
cd "C:\Program Files\Docker\Docker\" .\DockerCli.exe -SwitchDaemon
Give it two minutes and try to pull an image.
If it is still not working reboot, and try again:
cd "C:\Program Files\Docker\Docker\" .\DockerCli.exe -SwitchDaemon
After it is working
I recommend you to add the new stand alone docker to the path, so you can call it from the terminal at any moment.
Edit the variable PATH of your user profile (not System wide)
I recommend you to have it on top after Python.