Skip to content

Instantly share code, notes, and snippets.

@arulrajnet
Created March 30, 2016 04:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arulrajnet/ab5de5b57f4a796ba8555802619a019f to your computer and use it in GitHub Desktop.
Save arulrajnet/ab5de5b57f4a796ba8555802619a019f to your computer and use it in GitHub Desktop.
Docker container for lighttpd on port 8080.
FROM alpine:3.3
# referred from https://hub.docker.com/r/sebp/lighttpd/
MAINTAINER Arul <me@arulraj.net>
RUN apk add --update lighttpd \
&& rm -rf /var/cache/apk/* \
&& sed -i.bak "s/server.document-root/#server.document-root/g" /etc/lighttpd/lighttpd.conf \
&& echo server.document-root = var.basedir >> /etc/lighttpd/lighttpd.conf \
&& echo server.port = 8080 >> /etc/lighttpd/lighttpd.conf \
&& echo server.network-backend = \"writev\" >> /etc/lighttpd/lighttpd.conf
EXPOSE 8080
VOLUME /var/www/localhost
WORKDIR /var/www/localhost
ENTRYPOINT ["lighttpd", "-D", "-f", "/etc/lighttpd/lighttpd.conf"]
@arulrajnet
Copy link
Author

Build this as container

Download the dockerfile.

curl -ksSL https://gist.githubusercontent.com/arulrajnet/ab5de5b57f4a796ba8555802619a019f/raw/Dockerfile > Dockerfile
docker build -t arulrajnet/lighttpd:latest .

The size of the image is 6.161 MB

Using that container

Mount your files into /var/www/localhost

docker run --name lighttpd \
-v ${PWD}/html:/var/www/localhost \
-p 8080:8080 \
-d arulrajnet/lighttpd:latest

Now you can access in http://localhost:8080/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment