How to Reset the Sitecore Admin Password inside a Docker Container

Lock on a Keyboard

I’ve experienced an issue setting up the Lighthouse Demo and the Play Summit demo in recent weeks. Once I get through all the normal issues of setting up a new environment, I can’t log into Sitecore. I know I passed “b” to the init script, but alas, I get an invalid username and password error.

I’ve gotten around it by resetting the password in the database. Since the database is running in containers, This isn’t as straight forward as it seems. Connecting to your SQL instance in containers is covered well by Neil Killan on his blog post on “Querying your Sitecore SQL Container“, but for convenience you need to run the following command, specifying the id of your sql container.

>docker inspect container [containerID]

Where container id is the id for your container. You can easily copy the ID right from docker desktop by clicking the copy icon next to the ID.

Docker Desktop

Once you run that you will find the IP in the network section

Docker Inspect Container Result

Sitecore - Understanding Development Approaches: A Sitecore Outlook
Understanding Development Approaches: A Sitecore Outlook

Designing, building, and implementing top-notch experiences not only requires a great deal of planning, strategy, and time – it also requires the right digital experience platform (DXP) and the right development approach for your business needs.

Get the Guide

Copy that, and then look up the SQL sa password in the env file in the root of your solution.

Env File

That will allow you to login using the “sa” account into SQL Management studio.

Sql Login

Once there, you can reset the password on the admin account by running a query in the core database. After googling for that query, you’ll most likely end up on this stack overflow article.  

I think the higher ranked answers are for older versions of sitecore, but I found the answer by Dan Sinclair works for the Sitecore 10 instances these demo sites use.  For convenience here is the query:

    [IsApproved] ='1', 
    [IsLockedOut] ='0'WHEREUserId IN(
        SELECTUserId FROMdbo.aspnet_Users WHEREUserName ='sitecore\admin');

After running that, the account should be good to login with good old password “b”





Thoughts on “How to Reset the Sitecore Admin Password inside a Docker Container”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

David San Filippo, Engagement Director

David is an engagement director at Perficient, David estimates, architects and delivers digital marketing solutions at scale on the Sitecore Platform. A 3X Sitecore Technology MVP, David has written articles for MSDN Magazine and the Microsoft Architecture Journal. He has spoken at Sitecore Symposium, Sitecore Virtual Developer Day, user group meetings and code camps.

More from this Author

Subscribe to the Weekly Blog Digest:

Sign Up
Follow Us