Sign inSign up

craftdock/caddy

By craftdock

•Updated over 7 years ago

Minimal Alpine image with Caddy server

Image
0

549

craftdock/caddy repository overview

⁠caddy

This is a docker image for Caddy⁠ server running on Alpine container⁠ with runit⁠ process supervisor.

⁠Volumes

  • /etc/caddy
  • /etc/caddy/certificates
  • /var/www
  • /var/log

⁠Ports

  • 80
  • 443
  • 2015

⁠Available environment variables

NameDefault value
CADDY_AGREEfalse
CADDY_CAhttps://acme-v01.api.letsencrypt.org/directory
CADDY_CA_TIMEOUT10s
CADDY_CPU100%
CADDY_EMAIL[empty]
CADDY_GRACE5s
CADDY_HTTP2true
CADDY_QUIETfalse
CADDY_PORT2015
CADDY_HTTP_PORT80
CADDY_HTTPS_PORT443
PGID1050
PUID1050

⁠How to use this image

docker build -t craftdock/caddy .
docker run -it -d --name=caddy \
        -p 2015:2015 \
        -v $(PWD)/caddy/file/:/etc/caddy \
        -v $(PWD)/caddy/www/:/var/www \
            craftdock/caddy

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

⁠Saving Certificates

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

docker run -it -d --name=caddy \
        -p 80:80 -p 443:443 \
        -v $(PWD)/caddy/cert/:/root/.caddy \
        -v $(PWD)/caddy/file/:/etc/caddy \
        -v $(PWD)/caddy/www/:/var/www \
            craftdock/caddy

Here, /root/.caddy is the location inside the container where caddy will save certificates.

To start or stop caddy, get an sh command prompt inside the container:

docker exec -it caddy sh

# Start caddy
runit service caddy start
# Stop caddy
runit service caddy stop
# Restart caddy
runit service caddy restart
# Status of caddy
runit service caddy status

# Stop the container
runit stop

⁠An example

Have a look at the example folder⁠. You'll find out how to create an image based on craftdock/caddy

This example folder contains:

  • A simple web site (``simple-html`)
  • A simple web site (``simple-html-2`)
  • A simple web site on port 80 (``simple-html-80`)
  • A simple web site on port 8080 (``simple-html-8080`)
  • A simple web site (``simple-html-2`)

Tag summary

Content type

Image

Digest

Size

16 MB

Last updated

over 7 years ago

docker pull craftdock/caddy