mw866 / tunnel-keycloak

Keycloak with Cloudflare Tunnel using docker-compose

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cloudflare Argo Tunnel with Keycloak

Create a Keycloak lab environment on the Internet using docker-compose and Cloudflare Argo Tunnel (cloudflared) with just a few commands.

Run on Docker Desktop locally

  1. Install Cloudflare Argo Tunnel binary cloudflared on your local desktop device Download link

  2. Install Docker Desktop Download link

  3. Obtain a Argo Tunnel certificate

cloudflared tunnel login
  1. Set the environment variables
export KEYCLOAK_USER=<keycloak admin username>
export KEYCLOAK_PASSWORD=<keycloak admin password>
export TUNNEL_HOSTNAME=<keycloak hostname>
  1. Spin up the environment
docker-compose up
  1. Open the Keycloak's web admin UI at https://$TUNNEL_HOSTNAME

Docker Cheatsheet

docker-compose up 
docker-compose down
docker-compose pause
docker-compose unpause
docker-compose logs -f
docker ps

Known Issues

Connection refused

tunnel | time="2020-02-26T08:54:50Z" level=error msg="unable to connect to the origin" error="Get http://keycloak:8080: dial tcp 172.21.0.2:8080: connect: connection refused"

Explanation: cloudflared starts to connect to keycloak before keycloak is ready.

Solution: Increase TUNNEL_RETRIES

The official Keycloak docker images do not support architecture except amd64

Solution: Change the image in the docker-compose.yml to my unofficial multi-arch Keycloak image at mw866/keycloak

Reference

About

Keycloak with Cloudflare Tunnel using docker-compose

License:Apache License 2.0