-
-
Notifications
You must be signed in to change notification settings - Fork 1
Caddy v2.1.0
Run the container with the default Caddyfile
docker run -d --name caddy -p 80:8080/tcp -p 443:8443/tcp qmcgaw/caddy-scratch:v2.1.0
By default, this runs using the repository Caddyfile:
{
admin 0.0.0.0:2019
http_port 8080
https_port 8443
}
To use your own Caddyfile:
-
Create a directory
mkdir caddydir
-
Create a Caddyfile with the content you would like, in
caddydir/Caddyfile
. Note that at the top of your Caddyfile, there should be at least the following global block:{ http_port 8080 https_port 8443 }
-
Change the ownership and permission to match the Docker container
chown -R 1000 caddydir chmod -R 700 caddydir
If you are on Windows, you may skip this step.
-
Assuming your current file path is
/yourpath
, run the container with:docker run -d --name caddy -p 80:8080/tcp -p 443:8443/tcp \ -v /yourpath/caddydir:/caddydir qmcgaw/caddy-scratch:v2.1.0
You can also run the container with docker-compose up -d
and using this docker-compose.yml:
version: "3.7"
services:
caddy:
image: qmcgaw/caddy-scratch:v2.1.0
container_name: caddy
volumes:
- ./caddydir:/caddydir
environment:
- TZ=
network_mode: bridge
ports:
- 80:8080/tcp
- 443:8443/tcp
#- 2019:2019/tcp
restart: always
If log times are not correct, it's because you need to set your timezone in the TZ
environment variable. For example, add -e TZ=America/Montreal
to your Docker run command.
Update the docker image with docker pull qmcgaw/caddy-scratch:v2.1.0
.
You can also use the :latest
Docker tag to get more regular updates.
To access the Caddy API, you need:
- your Caddyfile to contain
admin 0.0.0.0:2019
at the top global block (as is in the default Caddyfile) - (eventually) have port 2019 published by adding
-p 2019:2019/tcp
to your Docker run command
Try it with
curl localhost:2019/config/
Note that many Caddy plugins do not work yet on Caddy v2.1.0.
You need Git installed.
If you want to have for example the github.com/caddyserver/ntlm-transport
plugin, build the image with
docker build -t qmcgaw/caddy:v2.1.0 \
--build-arg PLUGINS=github.com/caddyserver/ntlm-transport \
https://github.com/qdm12/caddy-scratch.git#v2.1.0