Notes on the installation of Keycloak using official jboss/keycloak Docker image.
Add the GPG key for the official Docker repo
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Add the Docker repository to APT sources
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Update package database
apt-get update
Install from the Docker repo, not the Ubuntu 16.04 distribution package.
apt-cache policy docker-ce
Install Docker Community Edition and Git
apt-get install -y docker-ce git
Run docker as a non-root user
Create the Keycloak user
adduser keycloak
Add keycloak user to the docker group. No sudo for docker commands
usermod -aG docker keycloak
Create the Keycloak network
docker network create keycloak-network
Deploy a PostGRES container for the Keycloak app
docker run -d --name keycloak-db --net keycloak-network -e POSTGRES_DB=keycloak -e POSTGRES_USER=keycloak -e POSTGRES_PASSWORD=password postgres
Deploy the Keycloak container
docker run -d --name keycloak-app --net keycloak-network -p 8443:8443 -e DB_ADDR=keycloak-db -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=password jboss/keycloak
Start Keycloak with Proxy Forwarding for use with Nginx
docker run -d --name keycloak-app --net keycloak-network -p 8443:8443 -e DB_ADDR=keycloak-db -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=password -e PROXY_ADDRESS_FORWARDING=true jboss/keycloak