https://github.com/hugodf/docker-compose-local-https
Examples of local HTTPS with docker-compose + mkcert + nginx/Caddy
https://github.com/hugodf/docker-compose-local-https
caddy docker docker-compose https https-proxy mkcert nginx nodejs tls
Last synced: about 1 month ago
JSON representation
Examples of local HTTPS with docker-compose + mkcert + nginx/Caddy
- Host: GitHub
- URL: https://github.com/hugodf/docker-compose-local-https
- Owner: HugoDF
- License: mit
- Created: 2019-03-06T23:39:42.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-01T17:52:16.000Z (almost 5 years ago)
- Last Synced: 2025-02-28T18:33:56.407Z (2 months ago)
- Topics: caddy, docker, docker-compose, https, https-proxy, mkcert, nginx, nodejs, tls
- Language: Shell
- Homepage: https://codewithhugo.com/docker-compose-local-https/
- Size: 6.84 KB
- Stars: 89
- Watchers: 2
- Forks: 19
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Docker Compose local HTTPS
> Examples of local HTTPS with docker-compose + mkcert
## Prerequisites
- [mkcert](https://github.com/FiloSottile/mkcert)
- [Docker Desktop](https://www.docker.com/products/docker-desktop)Run `mkcert -install`
Run `./init.sh` (creates local certificates using mkcert and copies them to where the Caddy and nginx examples expect them)
## The setup
Each example has a barebones Node app running on the official Node 10 Docker image running on port 8080.
The Node code is at [./caddy/app/index.js](./caddy/app/index.js), [./caddy-gen/app/index.js](./caddy-gen/app/index.js) and [./nginx/app/index.js](./caddy/app/index.js).
It also has a reverse-proxy set up using Caddy and nginx respectively which
## Caddy Example with Caddyfile
> Caddy is the HTTP/2 web server with automatic HTTPS.
>
> https://caddyserver.com/See [./caddy](./caddy), uses [https://github.com/abiosoft/caddy-docker](https://github.com/abiosoft/caddy-docker) Docker image.
To run it:
```sh
cd caddy
docker-compose up
```Then either navigate to https://foo.test or `curl https://foo.test`.
> Note: the nginx/Caddy examples needs to be stopped before starting this Caddy example
## Caddy Example with docker-gen
> Caddy is the HTTP/2 web server with automatic HTTPS.
>
> https://caddyserver.com/This image leverages [Docker-gen](https://github.com/jwilder/docker-gen) to "Generate files from docker container meta-data".
Which allows us to build the configuration for the reverse proxy using labels on the target container (without a Caddyfile, that's the file generated from the labels).
See [./caddy-gen](./caddy-gen), uses [https://github.com/wemake-services/caddy-gen](https://github.com/wemake-services/caddy-gen) Docker image.
```sh
cd caddy-gen
docker-compose up
```Then either navigate to https://foo.test or `curl https://foo.test`.
> Note: the nginx/other Caddy examples needs to be stopped before starting the Caddy example
## nginx Example
> [nginx](https://www.nginx.com/) is a web server which can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache.
>
> WikipediaSee [./nginx](./nginx), uses [https://github.com/jwilder/nginx-proxy](https://github.com/jwilder/nginx-proxy) Docker image.
This image leverages [Docker-gen](https://github.com/jwilder/docker-gen) to "Generate files from docker container meta-data".
```sh
cd nginx
docker-compose up
```Then either navigate to https://foo.test or `curl https://foo.test`.
> Note: the Caddy examples needs to be stopped before starting the nginx example