Static web hosting with docker

Mr Super Shetty
A Web Developer
Published in
1 min readJan 15, 2018

Dont overload your Nodejs, PHP or Ruby framework

We are gonna use Nginx as our server to serve static files. Luckily there is a docker nginx image. We will be using this docker image.

To achieve this just create the following Dockerfile

# Guide here:
# https://github.com/KyleAMathews/docker-nginx

# Build docker file
# docker build -t CONTAINERNAME .

# Build from this repo's image
FROM kyma/docker-nginx

# Add src.
COPY src/ /path/to/www

CMD 'nginx'

That’s all you need to serve static file from docker. This post was for someone who already knew how to work with docker. Now if you are new to Docker there are plenty of articles online. We are planning to write on docker for beginners but till then request you to read the plenty of articles available online.

Want us to write more

Hit claps if you liked it. It will encourage us to write more. Follow me for more posts on Docker and Server. Comment below if you have any other suggestions or inputs.

--

--