title: How to persist infinispan Session after Keycloak docker restart
body: <p>I have a running keycloak 8's docker but whenever I restart it, all non-offline session disappears. Result, all users are being disconnected whenever I come to update keycloak.</p>
  
  <h3>Causes:</h3>
  
  <ul>
  <li>I've read <a href="https://stackoverflow.com/questions/50203490/keycloak-access-tokens-invalid-after-keycloak-server-restart">this thread</a> here and understood why access token aren't persisted (mainly performance issue).</li>
  </ul>
  
  <p>As solution I've wanted to use Clusters (as recommended <a href="http://keycloak-user.88327.x6.nabble.com/keycloak-user-Remember-me-doesn-t-work-after-keycloak-restart-td1004.html" rel="nofollow noreferrer">here</a>), and I understood, that the core part is only well managing Infinispan.</p>
  
  <h3>Ideas:</h3>
  
  <ul>
  <li><p>I first wanted to store that infinispan outside docker container (in a volume), then search where does the JBoss saves Infinispan in a docker, but i didn't found anything.</p></li>
  <li><p>Secondly I thought about an SPI to manage user sessions externally, but it seems not to be the right solution, as infinispan does already a good Job.</p></li>
  <li><p>Setting up then a cluster, helped by <a href="https://www.keycloak.org/2017/09/cross-datacenter-support-in-keycloak.html" rel="nofollow noreferrer">this article about Cross-Datacenter support in Keycloak</a> and <a href="https://www.keycloak.org/2018/01/keycloak-cross-data-center-setup-in-aws.html" rel="nofollow noreferrer">this other one about Keycloak Cross Data Center Setup in AWS</a> seemed to be a good starting point, but I'm still actually using dockers and I not sure if it's a better idea for me to build docker images from those tutorials.</p></li>
  </ul>
  
  <p>Any more Idea would be welcome :)</p>