Skip to main content

Running an HTML site in seconds using Docker

Run any static HTML website in seconds with just ONE Docker command. Skip the headache of installing and configuring Apache or Nginx for a quick local setup.

· 3 min read
View raw
Christophe
Markdown, WSL and Docker lover ~ Insatiable curious.
Cet article existe aussi en français — lire la version française.

This article is over a year old but was reviewed on July 30, 2026 — the content is still accurate.

Running an HTML site in seconds using Docker

⚡
TL;DR

This article shows the fastest way to serve a static HTML site locally: no Apache/Nginx install needed, just one command — docker run -d --name static-site -p 8080:80 -v .:/usr/local/apache2/htdocs/ httpd:alpine — run from the site's folder, then browse to http://localhost:8080.

Imagine the following situation: you've an HTML website on your computer and you would like to run it. But how? Should you install Apache or Nginx? Yes, you should ... or just run exactly ONE COMMAND to start Docker.

Years ago, to open a local website, you needed to install f.i. EasyPhp or Wamp, configure a lot of things, restart the computer, make sure EasyPhp or Wamp was running in the background and ... pffffiou.

Those times are thankfully, definitively over.

For a change, this article will use PowerShell, but I could, of course, have used DOS or Linux. So let's play with Powershell.

Result​

Just one command, run from the folder containing your static site: docker run -d --name static-site -p 8080:80 -v .:/usr/local/apache2/htdocs/ httpd:alpine.

Once done, just start your preferred browser and surf to http://localhost:8080. Bingo!

http://localhost:8080

Your local website

You've a fully working site. Crazy no?

Why it works​

  • The httpd:alpine image mounts the current folder (-v .:/usr/local/apache2/htdocs/) as Apache's docroot, so whatever HTML is already on your disk gets served immediately.
  • Docker downloads Apache for you the first time; nothing to install, configure or keep running in the background.

Two natural follow-ups: your site is served by a real Apache, so every directive from Apache .htaccess file works here; and if your pages are not plain HTML but PHP, use The easiest way to run a PHP script / website instead.

Don't have a site to try this on yet?​

For the illustration, I'll download a free static website from https://github.com/toidicode/template. Take a look to demos and just download one ZIP.

I'll jump in my C:\temp directory and download the zip. To do this, I will execute the following command: curl https://github.com/toidicode/template/raw/master/src/100-cookingschool.zip -o demo.zip (yes, curl is available for PowerShell too).

The next thing to do is to unzip the file. I can do it with Windows Explorer for sure but I'm a console guy so let's run Expand-Archive demo.zip -DestinationPath demo.

Ok, now, we've a demo folder containing a static website. Jump into it: cd demo, then run the one command from above in that folder.

Conclusion​

One docker run, no Apache/Nginx install, no configuration file to touch: that's the whole recipe. Point it at any folder of static HTML and it's served in seconds — throw the container away with docker rm -f static-site when you're done and your disk is exactly as it was.


🦋 Join the conversation on BlueskyRequires a free Bluesky account to like, repost or comment. This block talks to Bluesky's public API directly from your browser (no cookies, no sign-in) — that means your IP address reaches Bluesky's servers just by this section loading.

Loading comments…

Was this article helpful?
Did you try the steps in this article?