blob: 85dc4b19aea095dc533c6f5a5049d89dbd253738 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# lighttpd Docker image
Security, speed, compliance, and flexibility -- all of these describe [lighttpd](http://www.lighttpd.net/)
### Contents
- Usage
- Start a container with Docker
- Start a container with Docker Compose
- Build
- Build with Docker
- Build with Docker Compose
- About
## Usage
In the instructions that follow, replace:
- `<home-directory>` with the path of the local directory you want to serve content from.
- `<config-directory>` with the path of the local directory containing lighttpd configuration files that you want to use instead of the default ones.
To make it easier to create custom configuration files, the default configuration files are included in the `etc/lighttpd` directory of the Git repository.
- `<http-port>` with the HTTP port you want the HTTP server to serve content to (e.g. `80` for the standard HTTP port if not already in use on the host).
### Start a container with Docker
With the default configuration files:
$ sudo docker run --rm -t -v <home-directory>:/var/www/localhost/htdocs -p <http-port>:80 sebp/lighttpd
With custom configuration files:
$ sudo docker run --rm -t -v <home-directory>:/var/www/localhost/htdocs -v <config-directory>:/etc/lighttpd -p <http-port>:80 sebp/lighttpd
### Start a container with Docker Compose
Add the following lines in an existing or a new `docker-compose.yml` file:
lighttpd:
image: sebp/lighttpd
volumes:
- <home-directory>:/var/www/localhost/htdocs
- <config-directory>:/etc/lighttpd
ports:
- "<http-port>:80"
**Note** – The `- <config-directory>:…` line is optional, it can be used to override the default configuration files with your own.
Then start a lighttpd container with:
$ sudo docker-compose up lighttpd
## Build
First clone or download the [spujadas/lighttpd-docker](https://github.com/spujadas/lighttpd-docker) GitHub repository, open a shell in the newly created `lighttpd-docker` directory, then build the image and run a container using Docker or Docker Compose, as explained below.
### Build with Docker
This command will build the image:
$ sudo docker build .
### Build with Docker Compose
Build the image with this command:
$ sudo docker-compose build
## About
Written by [Sébastien Pujadas](http://pujadas.net), released under the [MIT license](http://opensource.org/licenses/MIT).
|