Help! My Docker SQL Instance Won’t Start!

One day, I shut down my computer, as I usually do nightly. This time, I shut it down on a Friday and turned it back on after a holiday weekend, only to discover that Docker would not start!

The Error

Everything was fine on the Friday before this happened, and I turned on my computer on Tuesday, and it crashed multiple times. I wasn’t sure if it would ever come up again, but it did, and that’s when I got this Docker error:

Docker would not start. Every time I tried to start it, I got that error that only gave me the option to quit.

Digging Into The Error

It turns out that the settings.json file got corrupted somehow. It was full of NULLS:

I couldn’t pull out anything to put into the new settings.json file. I had to rename the settings.json file to .old. Well, it turns out its name is .oldest because I was trying to do some other fiddling for a while. Docker automatically creates a new settings.json file on start. If you rename that settings file while it’s running, it creates one automatically and immediately.

The “Fix”

I say fix in quotes because I didn’t fix that error. I could not fix it as the old settings file was all NULLS or blank. The Windows event log had nothing useful. There were some VSS and SPP errors in the Application log, but nothing I could fix with Docker. The system event log claimed that the previous shutdown on October 6th was unexpected, but I purposely shut it down on that day/time. Then, it wouldn’t start on Monday morning, the 10th.

Since then, my computer has been fine, and Docker could run, but my containers wouldn’t start. Naturally, this is because the settings.json file doesn’t have a record of them. I had to delete those containers and start over.

Persistent Storage Saved Me

Thankfully, I didn’t have to recreate my SQL instance contents from scratch. This is because, thanks to my past self, I had written a blog post on persistent storage and was actually using persistent storage.

That being said, I ran the query to set up the new container:

docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=thisisastrongpassw0rd!" -p 1436:1433 --name sql2019 -v c:/docker/sql2019/data:/var/opt/mssql/data -v c:/docker/sql2019/secrets:/var/opt/mssql/secrets -d

But it was hung up on a flashing cursor. I might have to uninstall and reinstall Docker, but thankfully, it was enough to upgrade Docker, and then my command worked.

All my databases and settings were back in place. It worked like a charm! If I didn’t have persistent storage, I would have spent a long time recreating databases, agent jobs, linked servers, etc. Persistent storage is a lifesaver!

Leave a Reply

Your email address will not be published. Required fields are marked *

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