Create a Keycloak lab environment on the Internet using docker-compose
and Cloudflare Argo Tunnel (cloudflared
) with just a few commands.
-
Install Cloudflare Argo Tunnel binary
cloudflared
on your local desktop device Download link -
Install Docker Desktop Download link
-
Obtain a Argo Tunnel certificate
cloudflared tunnel login
- Set the environment variables
export KEYCLOAK_USER=<keycloak admin username>
export KEYCLOAK_PASSWORD=<keycloak admin password>
export TUNNEL_HOSTNAME=<keycloak hostname>
- Spin up the environment
docker-compose up
- Open the Keycloak's web admin UI at
https://$TUNNEL_HOSTNAME
docker-compose up
docker-compose down
docker-compose pause
docker-compose unpause
docker-compose logs -f
docker ps
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
Solution: Change the image
in the docker-compose.yml
to my unofficial multi-arch Keycloak image at mw866/keycloak