Chris Rockwell
Chris Rockwell

Reputation: 1852

Docker container running SQL Server seems to crash every time

I created a Docker container:

sudo docker pull microsoft/mssql-server-linux:2017-latest

Then I ran it:

sudo docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=root' -p 1401:1433 
                --name sqlserver1 -d microsoft/mssql-server-linux:2017-latest

I ran:

docker start sqlserver1

After about 3 seconds docker ps returns empty - making me think the container is shutting down.

I'm new to Docker - is this really shutting down automatically? If so, how do I prevent that?

Upvotes: 7

Views: 8611

Answers (1)

larsks
larsks

Reputation: 312770

I gave this a shot, and it looks as if your problem is not a Docker problem...it's simply a MSSQL problem. If you look at the logs for your container, you'll see:

ERROR: Unable to set system administrator password: Password validation failed.
The password does not meet SQL Server password policy requirements because it is
too short. The password must be at least 8 characters.

It looks as if MSSQL enforces password complexity requirements, which include length and number of character classes. The following seems to work fine:

docker run -it -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=r00t.R00T' -p 1401:1433 --name sqlserver1 microsoft/mssql-server-linux:2017-latest

Upvotes: 16

Related Questions