coreos/caddy-docker

Name: caddy-docker

Owner: CoreOS

Description: Docker container for Caddy

Forked from: abiosoft/caddy-docker

Created: 2016-08-22 21:18:21.0

Updated: 2016-08-22 21:18:22.0

Pushed: 2016-08-29 21:03:55.0

Homepage: null

Size: 25

Language: PHP

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

caddy

A Docker image for Caddy. This image includes the git addon.

Getting Started
cker run -d -p 2015:2015 abiosoft/caddy

Point your browser to http://127.0.0.1:2015.

PHP

:[<version>-]php variant of this image bundles PHP-FPM alongside essential php extensions and composer. e.g. :php, :0.8.0-php

cker run -d -p 2015:2015 abiosoft/caddy:php

Point your browser to http://127.0.0.1:2015 and you will see a php info page.

Local php source

Replace /path/to/php/src with your php sources directory.

cker run -d -v /path/to/php/src:/srv -p 2015:2015 abiosoft/caddy:php

Point your browser to http://127.0.0.1:2015.

Note

Your Caddyfile must include the line startup php-fpm. For Caddy to be PID 1 in the container, php-fpm could not be started.

Using git sources

Caddy can serve sites from git repository using git middleware.

Create Caddyfile

Replace github.com/abiosoft/webtest with your repository.

intf "0.0.0.0\ngit github.com/abiosoft/webtest" > Caddyfile
Run the image
cker run -d -v $(pwd)/Caddyfile:/etc/Caddyfile -p 2015:2015 abiosoft/caddy

Point your browser to http://127.0.0.1:2015.

Usage
Default Caddyfile

The image contains a default Caddyfile.

0.0
se
cgi / 127.0.0.1:9000 php # php variant only
tup php-fpm # php variant only

The last 2 lines are only present in the php variant.

Paths in container

Caddyfile: /etc/Caddyfile

Sites root: /srv

Using local Caddyfile and sites root

Replace /path/to/Caddyfile and /path/to/sites/root accordingly.

cker run -d \
-v /path/to/sites/root:/srv \
-v path/to/Caddyfile:/etc/Caddyfile \
-p 2015:2015 \
abiosoft/caddy
Let's Encrypt Auto SSL

Note that this does not work on local environments.

Use a valid domain and add email to your Caddyfile to avoid prompt at runtime. Replace mydomain.com with your domain and user@host.com with your email.

main.com
user@host.com
Run the image

You can change the the ports if ports 80 and 443 are not available on host. e.g. 81:80, 444:443

cker run -d \
-v $(pwd)/Caddyfile:/etc/Caddyfile \
-p 80:80 -p 443:443 \
abiosoft/caddy

Optional but advised. Save certificates on host machine to prevent regeneration every time container starts. Let's Encrypt has rate limit.

cker run -d \
-v $(pwd)/Caddyfile:/etc/Caddyfile \
-v $HOME/.caddy:/root/.caddy \
-p 80:80 -p 443:443 \
abiosoft/caddy

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.