An open-source web server optimized for speed-critical environments
10K+
Derived from the "port" by Adam Miller [email protected] from https://github.com/fedora-cloud/Fedora-Dockerfiles Originally written for Fedora-Dockerfiles by Stephen Tweedie [email protected]
ClefOS 7 dockerfile for lighttpd (http://www.lighttpd.net/)
You should prepare SSH public key so you'll be able to login to the container (sshd config denies login to any other user):
ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa): /tmp/lighttpd/.ssh/id_dsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /tmp/lighttpd/.ssh/id_dsa.
Your public key has been saved in /tmp/lighttpd/.ssh/id_dsa.pub.
The key fingerprint is:
46:ee:f2:38:14:1d:da:72:13:b6:8a:ee:56:6f:f1:f1 [email protected]
The key's randomart image is:
+--[ DSA 1024]----+
| |
| + |
| =.+ |
| +o* |
| . =S. |
| . +o. . |
| . o...o o |
| o .+o . E |
| o. .o. |
+-----------------+
Change the ownership of the public key file to that of the running container. e.g.
chown 999:998 /tmp/lighttpd/.ssh/id_dsa.pub
chown 999:998 /tmp/lighttpd.ssh
Prepare directories for logs and configs and htdocs:
$ mkdir /srv/docker_mounts/lighttpd/{logs,configs,htdocs} -p
If you have prepared lighttpd.conf you can put it now in /srv/docker_mounts/lighttpd/configs (this dir will be mounted as /etc/lighttpd in the container). If not than the default will be generated and used by lighttpd daemon.
Clone Dockerfile somewhere and build the container:
$ sudo docker build -t lighttpd:centos7 --rm .
Take note of ssh lighttpd user password during above build process - you'll need that later:
Step 17 : RUN /root/scripts/init.sh
...
lighttpd ssh password: uk3pieWi
And now run the container:
On docker 1.8.0+:
$ sudo docker run -d -p 8091:80/tcp -v /srv/docker_mounts/lighttpd/configs:/etc/lighttpd -v /srv/docker_mounts/lighttpd/logs:/var/log/lighttpd -v /srv/docker_mounts/lighttpd/htdocs/:/srv/httpd/htdocs -v /tmp/lighttpd/.ssh/id_dsa.pub:/home/lighttpd/.ssh/authorized_keys --name=lighttpd -t lighttpd:centos7
In above example params means:
After running container it should be working fine and you should be able to ssh to it using ssh key that you can map using the identity created above (/tmp/lighttpd/.ssh/id_dsa).
Just try accessing some webpage (did you generate and put any in the htdocs dir?). First let's check container IP:
$ sudo docker inspect -format '{{ .NetworkSettings.IPAddress }}' container_id
And next use use links:
$ links http://@container_IP_ADDR/index.html
Also try to ssh to the container with lighttpd user:
$ ssh -i /tmp/lighttpd/.ssh/id_dsa lighttpd@container_IP
Seeing only 404 error? Probably you didn't put any index.html into htdocs dir. Also remember that default lighttpd config expects htdocs/lighttpd as the public directory so you should create e.g. htdocs/lighttpd/index.html file
In order to change configuration just edit cfg files in host /srv/docker_mounts/lighttpd/configs (remember that this dir is mounted on /etc/lighttpd/ in container) and run a command:
$ ssh lighttpd@container_IP "sudo /etc/init.d/lighttpd restart"
You can access logfiles within host in /srv/docker_mounts/lighttpd/logs; those logs are rotated by containers logrotate.
Content type
Image
Digest
Size
84.2 MB
Last updated
about 9 years ago
docker pull sinenomine/lighttpd-s390x