<div dir="ltr">Ah, ok I&#39;ll try that. The original issue though was that it wasn&#39;t picking up the admin user from the existing 1.7.0 database.<div><br></div><div>Ok. Now I&#39;ve got further. I can start Keycloak 2.0.0 on a new database by adding the admin user to the environment. It still doesn&#39;t work on my old database.</div><div><br></div><div>I get these errors indicating that it&#39;s trying to add the admin user and failing as it already exists:</div><div><div>keycloak_1 | 2016-08-17T17:24:10.666079599Z 17:24:10,665 INFO  [org.keycloak.services] (ServerService Thread Pool -- 49) KC-SERVICES0006: Importing users from &#39;/opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json&#39;</div><div>keycloak_1 | 2016-08-17T17:24:10.777277798Z 17:24:10,777 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (ServerService Thread Pool -- 49) SQL Error: 1062, SQLState: 23000</div><div>keycloak_1 | 2016-08-17T17:24:10.777402463Z 17:24:10,777 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (ServerService Thread Pool -- 49) Duplicate entry &#39;master-admin&#39; for key &#39;UK_RU8TT6T700S9V50BU18WS5HA6&#39;</div><div>keycloak_1 | 2016-08-17T17:24:10.778545355Z 17:24:10,778 INFO  [org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl] (ServerService Thread Pool -- 49) HHH000010: On release of batch it still contained JDBC statements</div><div>keycloak_1 | 2016-08-17T17:24:10.784002565Z 17:24:10,783 ERROR [org.keycloak.services] (ServerService Thread Pool -- 49) KC-SERVICES0010: Failed to add user &#39;admin&#39; to realm &#39;master&#39;: user with username exists</div><div><br></div><div>Problem is that the admin login is now admin/admin which I set in the environment vars, not the original admin user password from the old installation. Once I&#39;m in I see I have a completely empty database. I&#39;m confused,</div><div><br></div><div><br></div><div><br></div></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><br></div><div><div style="color:rgb(0,0,0);font-size:12.8px"><div><font face="verdana, sans-serif"><b>Kevin Thorpe</b></font></div><div style="font-family:&#39;Times New Roman&#39;">VP Enterprise Platform</div><div style="font-family:&#39;Times New Roman&#39;"><img src="http://i.imgur.com/8UeC1YO.png" width="96" height="96"><br></div><div style="font-family:&#39;Times New Roman&#39;"><a href="http://www.p-i.net/" style="color:rgb(17,85,204);line-height:18.6311px" target="_blank">www.p-i.net</a> | <a href="https://twitter.com/@PI_150" style="color:rgb(17,85,204);line-height:18.6311px" target="_blank">@PI_150</a></div><br><b style="font-family:&#39;Times New Roman&#39;">T: <a href="tel:%2B44%20%280%2920%203005%206750" value="+442030056750" style="color:rgb(17,85,204)" target="_blank">+44 (0)20 3005 6750</a>  | F: <a href="tel:%2B44%280%2920%207730%202635" value="+442077302635" style="color:rgb(17,85,204)" target="_blank">+44(0)20 7730 2635</a>  | T: <a href="tel:%2B44%20%280%29808%20204%200344" value="+448082040344" style="color:rgb(17,85,204)" target="_blank">+44 (0)808 204 0344</a> </b><br><b style="font-family:&#39;Times New Roman&#39;"><font color="#515151">150 Buckingham Palace Road, London, SW1W 9TR, UK</font></b><font face="Times New Roman"> </font><br><br><div style="font-family:&#39;Times New Roman&#39;"><a><img src="https://clients.p-i.net/documents/11003/1116416/BSI-UKAS.logo_150.png" height="40px"></a>     <a><img src="https://clients.p-i.net/documents/11003/1116416/ISO27001.logo_150.png" height="40px"></a>     <a><img src="https://clients.p-i.net/documents/11003/1116416/QMS.logo_150.png" height="40px"></a>     <a><img src="https://clients.p-i.net/documents/11003/1116416/pci.logo_150.png" height="40px"></a></div></div><div style="color:rgb(0,0,0);font-family:&#39;Times New Roman&#39;;font-size:medium"><br><b><span style="color:rgb(106,168,79)">SAVE PAPER - THINK BEFORE YOU PRINT!</span></b><p><font size="1">____________________________________________________________________</font></p><p style="color:rgb(34,34,34)"><font size="1">This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.</font></p></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On 17 August 2016 at 18:02, Jagannadha Rekala <span dir="ltr">&lt;<a href="mailto:jarekala@axway.com" target="_blank">jarekala@axway.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><a name="m_-3327282465844039610__MailEndCompose"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">There needs to be an admin user created while Keycloak being started. So, you need to pass the environment variables to the docker container.
 Without passing the environment variables Keycloak will not have an admin user unless you use the previous database of Keycloak that had admin user already. Try adding these two variables in your compose file and let us know.<u></u><u></u></span></a></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">    - KEYCLOAK_USER=admin<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">    - KEYCLOAK_PASSWORD=password-<wbr>here<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Thanks,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Jagan Rekala<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"> <a href="mailto:keycloak-user-bounces@lists.jboss.org" target="_blank">keycloak-user-bounces@lists.<wbr>jboss.org</a> [mailto:<a href="mailto:keycloak-user-bounces@lists.jboss.org" target="_blank">keycloak-user-bounces@<wbr>lists.jboss.org</a>]
<b>On Behalf Of </b>Kevin Thorpe<br>
<b>Sent:</b> Wednesday, August 17, 2016 9:48 AM<br>
<b>To:</b> keycloak-user &lt;<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.jboss.org</a><wbr>&gt;<br>
<b>Subject:</b> [keycloak-user] Cannot log in as admin when using docker image 2.0.0 mysql<u></u><u></u></span></p><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">I&#39;m trying to use Keycloak 2.0.0 from the docker image using mysql and I can&#39;t log in once running. It all starts up ok and it creates the initial schema ok. When I try to log in to the admion console it can&#39;t find the admin user. What
 am I doing wrong? I thought it was my modifications to the image to add https that were wrong but it doesn&#39;t work from the published image anyway.<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">lots snipped....<u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">keycloak_1 | 2016-08-17T16:39:58.280453387Z 16:39:58,280 INFO  [<a href="http://org.jboss.as" target="_blank">org.jboss.as</a>] (Controller Boot Thread) WFLYSRV0025: Keycloak 2.0.0.Final (WildFly Core 2.0.10.Final) started in 29551ms - Started 418 of 800
 services (542 services are lazy, passive or on-demand)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">keycloak_1 | 2016-08-17T16:40:16.238260785Z 16:40:16,237 WARN  [org.keycloak.events] (default task-7) type=LOGIN_ERROR, realmId=master, clientId=security-admin-<wbr>console, userId=null, ipAddress=10.20.11.52, error=user_not_found, auth_method=openid-connect,
 auth_type=code, redirect_uri=<a href="http://10.20.13.236:8080/auth/admin/master/console/" target="_blank">http://10.20.13.<wbr>236:8080/auth/admin/master/<wbr>console/</a>, code_id=2bde62ed-9b9f-4620-<wbr>b07f-39d4a282098c, username=admin<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">docker-compose.yml is:<u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">keycloak:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">  image: jboss/keycloak-mysql:2.0.0.<wbr>Final<u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">#  image: <a href="http://docker.pibenchmark.com/pi-keycloak:2.0.0-01" target="_blank">
docker.pibenchmark.com/pi-<wbr>keycloak:2.0.0-01</a><u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal">  environment:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">    MYSQL_PORT_3306_TCP_ADDR: mysql<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">    MYSQL_PORT_3306_TCP_PORT: 3306<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">    MYSQL_USERNAME: keycloak<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">    MYSQL_PASSWORD: xxxxxx<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">  ports:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">    - &quot;8443:8443/tcp&quot;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">    - &quot;8080:8080/tcp&quot;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">  links:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">    - keycloak-db:mysql<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">#  tty: true<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">#  stdin_open: true<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">keycloak-db:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">  environment:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">    MYSQL_ROOT_PASSWORD: yyyyyy<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">    MYSQL_DATABASE: keycloak<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">    MYSQL_USER: keycloak<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">    MYSQL_PASSWORD: xxxxxx<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">  image: mysql/mysql-server:5.6<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">  volumes:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">  - keycloak-test-db:/var/lib/<wbr>mysql<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">  volume_driver: convoy<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><b><span style="font-size:9.5pt;font-family:&quot;Verdana&quot;,sans-serif;color:black">Kevin Thorpe</span></b><span style="font-size:9.5pt;color:black"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">VP Enterprise Platform<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black"><img border="0" width="96" height="96" src="http://i.imgur.com/8UeC1YO.png"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black"><a href="http://www.p-i.net/" target="_blank"><span style="color:#1155cc">www.p-i.net</span></a> | <a href="https://twitter.com/@PI_150" target="_blank"><span style="color:#1155cc">@PI_150</span></a><u></u><u></u></span></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:9.5pt;color:black"><br>
<b>T: <a href="tel:%2B44%20%280%2920%203005%206750" target="_blank"><span style="color:#1155cc">+44 (0)20 3005 6750</span></a>  | F: <a href="tel:%2B44%280%2920%207730%202635" target="_blank"><span style="color:#1155cc">+44(0)20 7730 2635</span></a>  | T: <a href="tel:%2B44%20%280%29808%20204%200344" target="_blank"><span style="color:#1155cc">+44
 (0)808 204 0344</span></a> </b><br>
</span><b><span style="font-size:9.5pt;color:#515151">150 Buckingham Palace Road, London, SW1W 9TR, UK</span></b><span style="font-size:9.5pt;color:black"> <u></u><u></u></span></p>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black"><img border="0" src="https://clients.p-i.net/documents/11003/1116416/BSI-UKAS.logo_150.png">     <img border="0" src="https://clients.p-i.net/documents/11003/1116416/ISO27001.logo_150.png">     <img border="0" src="https://clients.p-i.net/documents/11003/1116416/QMS.logo_150.png">     <img border="0" src="https://clients.p-i.net/documents/11003/1116416/pci.logo_150.png"><u></u><u></u></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:13.5pt;color:black"><br>
</span><b><span style="font-size:13.5pt;color:#6aa84f">SAVE PAPER - THINK BEFORE YOU PRINT!</span></b><span style="font-size:13.5pt;color:black"><u></u><u></u></span></p>
<p><span style="font-size:7.5pt;color:black">______________________________<wbr>______________________________<wbr>________</span><span style="font-size:13.5pt;color:black"><u></u><u></u></span></p>
<p><span style="font-size:7.5pt;color:#222222">This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system
 manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have
 received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.</span><span style="font-size:13.5pt;color:#222222"><u></u><u></u></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></div></div>
</div>

</blockquote></div><br></div>