Install docker desktop on Windows and run HTML website with Nginx

Install docker desktop on Windows and run HTML website with Nginx

Watch the video above to install Docker desktop on Windows and then run an HTML static website using Nginx Alpine docker image.

Video Captions

Welcome to this video. In this video, we are going to see how to install Docker desktop on Windows. Just search for Docker desktop.

Download for Windows.

Click there. If you click on that, you can start downloading. If you go back, you can also just click there. And then click on that button to download it. Docker desktop is also available for Linux so if you wanted to use it on Linux you can use it on Linux as well.
Let’s wait for the download to finish and once it’s done we are going to install it. I can just click there on open and this is going to start installing Docker desktop on Windows.

Here use WSL2. If you don’t have WSL enabled you’ll have to enable WSL first and if WSL is not working, especially WSL2 you’re going to have to go into your BIOS, and then enable virtualization.

I know there are tutorials for that. You can check for that and just see how to enable wsl2 before continuing with this Docker installation because Docker recommends that you use wsl2 instead of hyper-v . We’re just going to click OK.

All right after waiting everything is done. You can close and log out, so I’m just going to close. Let me log out then, and then we’re going to come back, and then we’re going to try to run a static application on docker.

After signing out and signing back in, let’s open Docker desktop. If you don’t see this screen, just close the bigger screen, there’s usually a bigger screen that might show up.
Docker desktop is not running, Docker engine is stopped. Just minimize that screen so that you can see this and accept the terms. Yeah, this is a screen that may show up. If you see this screen, it’s probably hiding the other one behind it.

You can see this. This is because virtualization is probably not enabled on my BIOS. If you have already enabled WSL you will experience this problem as well whereby you need to enable virtualization in the bios.

What you can do is go online and search for how to enable virtualization in your specific motherboard. AMD and Intel usually do it differently, so depending on your motherboard you need to Google and find out the exact steps you need to do on your bios to enable virtualization.

I’ve just enabled virtualization on my BIOS, let’s open up Docker desktop. I’ve been waiting for a while, this seems to be stuck here, let’s see if I can run any WSL app I think I have Debian.

So Debian seems to be running fine.

Debian on my WSL seems to be running, so what could be the problem ? Let me restart the computer one last time, and then we’ll see how it goes after that.

After restarting the PC, it seems to be working okay. If it’s still taking some time, just click there on settings, click on all these other things just to see if that’s going to keep it moving.

Close that .now there you go, Docker desktop is installed. Just in brief, the things that are important; firstly, you need to enable WSL2. There are lots of tutorials for that. You can also find the tutorial on Microsoft documentation. And then depending on your bios, depending on your operating system motherboard you need to enable virtualization. Go to Google and search for your motherboard’s how to enable virtualization .then you can start Docker again after restarting your PC. Now let’s just do a test. I will come here, and I want to just download something from my GitHub here.

HTML. I just want to test this HTML. I’ll click on it and I want to download it .let me just go back and download the entire thing. I’ll come here under code and I want to download it as a zip. I don’t want to pull.

Let me create a folder where we can try all this. I’ve created a folder on my desktop, I’m just going to drag in this one, and can we open it with Visual Studio Code? Yes we can.

If you don’t know Docker there are lots of tutorials, but you can go to the docker documentation on the getting started part, you’ll learn a lot from that area. The Docker documentation is pretty well written. If I come here, we have a Docker compose file. From this image it’s going to create a container from that image, and it’s going to build it from a Docker file and restart always, I don’t really needed to restart always, so I’m just going to remove this. If you restart it always, it will always start with Docker and Docker automatically starts with the computer if you enable it.

If you don’t want it to start with the computer, you can go into your task manager and disable it from there. Ctrl S. we’re going to be able to access it from this port. This is the port that we will be able to access it from on the host, and then this is the one that we can access it from in Docker.

This is the port in Docker that is being forwarded to that and then Docker file here we have an image from Nginx Alpine and then our working directory is site. Inside the site, we just have a sample HTML, and then we’re going to copy everything inside into static, and then you’re going to copy everything from the nginx configuration.

Because I’m using nginx on this, I’m going to copy this nginx configuration. You can see we are listening on Port 5000 and server name we’re just going to listen on localhost.

This means that it’s listening on IPv6 and this is listening on ipv4. And then the server name if we see localhost then we’re going to serve something. if you need to run this, let’s open integrated terminal here. We’re going to run the compose file. Ctrl L. I’m just going to do docker compose up and since we are building something we’re going to build, and then we’re going to do -d this will open it in the background.

Dash D

It is going to pull the image and anything else that it needs to run. Meanwhile, if we go to localhost, now let’s see if there’s anything on localhost, lo cal host.

You can see right now there is nothing, the container is still pulling things

The container is still pulling things the moment you see running, then that means that the container should be running as well. So let’s see what is the problem here, we have a problem. It is probably in our nginx configuration, server name localhost root static site/static let’s come back here.

oh, yeah it’s a good thing that I came here because men sometimes you just get confused over very simple things, so let me explain it before we see it. If you come here, you’ll see that we are supposed to access it on port 5000. So let me use port 5000.

There it works if you access it on port 5000 .you’re going to see our Pages there. All right. So we’ve tested, and we’ve seen that if we go to Port 5000 we can access our static website. If you want to test the others, you can see if you come here, if you download the folder, and you’re following along you’ll see that there’s another one for WordPress that you can try on your own.

If you have any questions, feel free to let me know. We were installing docker desktop, and we’ve installed it successfully. We can just delete this since we are on Docker desktop we can just delete this one from here, or we can just bring it down first. I’m just going to delete it. Delete forever. There you go. See you next time in another video.

Comment Here

Need WordPress help? Linux Server help? Talk to us.

  • We are your own WordPress customer service.
  • We set up Linux servers and install or migrate WordPress. Learn more here.
  • We support WooCommerce too.
  • Check out our WordPress customer support plans here or contact us below .

If you have any questions regarding WordPress support, Linux server support or any of our services, feel free to reach out or read more on our services page.

Join this free course:

How to host multiple WordPress
websites on a VPS

Close me!