Publish a Docker Windows image to Docker Hub using Visual Studio
I wrote this article that explained how to include Docker support in Visual Studio “How to add Docker support to your ASP.NET Core application”. Check it out. To publish the image to Docker Hub (*) so that it can be used for building a Web App for Containers which I discuss here “Publish a Web App for Containers Windows Docker Image”, perform the following.
Right-click on the project and select Publish which will open a popup similar to that shown in Figure 1.
Figure 1, publish a docker image to docker hub for docker on windows web app for containers
Like I mentioned in this article “”, you need to have Docker for Windows installed to complete the process. I received the following error when I attempted to publish without Docker for Windows being installed on my client. See also Figure 2.
Severity Code Description Project File Line Suppression State
Error Docker is not installed or is not in the current PATH. docker001 0
Figure 2, publish a docker image to docker hub for docker on windows web app for containers
This is the version I installed…Figure 3.
Figure 3, publish a docker image to docker hub for docker on windows web app for containers
The installation updates the environment path on your workstation so you can do stuff now using PowerShell too, but I like GUI to I will remain in Visual Studio…Figure 4.
Figure 4, publish a docker image to docker hub for docker on windows web app for containers, using PowerShell
After that one I got this tricky exception, Figure 5.
Severity Code Description Project File Line Suppression State
Error The command "docker build -t "docker001" -f "Dockerfile" ".."" exited with code 1. docker001 0
Figure 5, publish a docker image to docker hub for docker on windows web app for containers
It did not give me much information, so after some research I realized the verbosity of the MSBuild process could be modified and did that. As seen in Figure 6 I changed the MSBuild project build output verbosity to Diagnostic.
Figure 6, publish a docker image to docker hub for docker on windows web app for containers
Which rendered this very helpful message:
container ‘’’ encountered an error during CreateContainer: failure in a Windows system call:
No hypervisor is present on this system.
I did have Hyper-V on my machine, Figure 7, so I scratch my head for a few moments.
Figure 7, publish a docker image to docker hub for docker on windows web app for containers, hyper-V
Having installed Hyper-V a few times and having written these 2 articles about that here “Installing Window 8 Beta on Hyper-V, Key Combinations” and “How to install IIS and Tracing on a Nano for Windows Server 2016” here, I remembered that there was a BIOS modification required to get Hyper-V to work. I shutdown all my open windows and did a reboot of my machine. Accessing the BIOS is different based on the brand of your workstation, for me I had to press F10. This opened the BIOS and in the Device Configuration section I had to enable Virtualization Technology, Figure 8.
Figure 8, publish a docker image to docker hub for docker on windows web app for containers, hyper-V, virtualization technology, docker on windows
Once I saved that configuration and restarted, the publish completed and I had my first image on Docker Hub, Figure 9.
Figure 9, publish a docker image to docker hub for docker on windows web app for containers, hyper-V, virtualization technology, docker on windows
Now, let’s publish the image to an Azure Web App for Container, read on here “Publish a Web App for Containers Windows Docker Image”.