Microsoft SQL Server on Linux for Docker Engine. Learn more about the latest release of SQL Server on Linux here: SQL Server on Linux Documentation. For any questions or issues, please contact us through a GitHub issue.
- Dockerfile: mssql-server-linux:latest
Additional Microsoft SQL Server Docker Images
- SQL Server for Windows Containers: microsoft/mssql-server-windows
- SQL Server Express for Windows Containers: microsoft/mssql-server-windows-express
Requirements
- This image requires Docker Engine 1.8+ in any of their supported platforms.
- At least 3.25 GB of RAM. Make sure to assign enough memory to the Docker VM if you're running on Docker for Mac or Windows.
- Requires the following environment flags
- ACCEPT_EULA=Y
- SA_PASSWORD=<your_strong_password>
- A strong system administrator (SA) password: At least 8 characters including uppercase, lowercase letters, base-10 digits and/or non-alphanumeric symbols.
How to use this image
Start a mssql-server instance
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=yourStrong(!)Password' -p 1433:1433 -d microsoft/mssql-server-linux
Connect to Microsoft SQL Server
Starting with the CTP 1.4 (March 17, 2017) release the mssql-tools package including sqlcmd, bcp are included in the image. You can connect to the SQL Server using the sqlcmd tool inside of the container by using the following command on the host:
docker exec -it <container_id|container_name> /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P <your_password>
You can also use the tools in an entrypoint.sh script to do things like create databases or logins, attach databases, import data, or other setup tasks. See this example of using an entrypoint.sh script to create a database and schema and bcp in some data.
You can connect to the SQL Server instance in the container from outside the container by using various command line and GUI tools on the host or remote computers. See the Connect and Query topic in the SQL Server on Linux documentation.
Environment Variables
- ACCEPT_EULA confirms your acceptance of the End-User Licensing Agreement.
- SA_PASSWORD is the database system administrator (userid = 'sa') password used to connect to SQL Server once the container is running. Important note: This password needs to include at least 8 characters of at least three of these four categories: uppercase letters, lowercase letters, numbers and non-alphanumeric symbols.
License
By passing the value "Y" to the environment variable "ACCEPT_EULA", you are expressing your acceptance of the End-User License Agreement.
User Feedback
- For issues with or questions about this image, please contact us through a GitHub issue.
Further Reading
- SQL Server on Linux for Docker documentation.
- SQL Server - Developer Getting Started Tutorials.
- SQL Server Docker GitHub Repository
It seems the last update (2017-07-17) broke volume mounting on Windows. When I run:
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=yourStrong(!)Password' -v c:/users/public/sqldata:/var/opt/mssql/data -p 1433:1433 microsoft/mssql-server-linux
The files master.mdf, mastlog.ldf, model.mdf, modellog.ldf, msdbdata.mdf, msdblog.ldf are created in c:/users/public and I get this error:
The tail of the log for database master is being rewritten to match the new sector size of 4096 bytes. 3072 bytes at offset 418816 in file /var/opt/mssql/data/mastlog.ldf will be written.
Converting database 'master' from version 862 to the current version 869.
Database 'master' running the upgrade step from version 862 to version 863.
Database 'master' running the upgrade step from version 863 to version 864.
Error: 17053, Severity: 16, State: 1.
/var/opt/mssql/data/mastlog.ldf: Operating system error 31(A device attached to the system is not functioning.) encountered.
Error: 928, Severity: 20, State: 1.
During upgrade, database raised exception 9002, severity 17, state 0, address 0000000404CD0A1E. Use the exception number to determine the cause.
Error: 9002, Severity: 17, State: 0.
The transaction log for database 'master' is full due to 'NOTHING'.
It works fine with the older image (microsoft/mssql-server-linux:ctp2-1)
Any idea why?
why is it mandatory to have a strong password? I'm using for local development mostly, it is so annoying to type that crazy string!
@shammishailaj check the logs, but looking at the way you started the image the password doesn't meet the required security standards. That's what happened to me, so I had to use a more complicated password.
@shammishailaj, check memory >4G
Please enlarge default memory to 4g, otherwise it would fail to start
@loadtool - each time you refresh the bits with the monthly release it will reset the countdown timer. Express Edition will be available at General Availability so you can run in perpetuity.
Is there a way to change the license from an eval to express edition? I would like use this for internal automated testing, but I would need it for longer than the 180 days provided in the eval.
@shammishailaj - It is most likely that you do not have enough memory allocated to the Xhyve VM that is running the Docker Engine. By default on Docker for Mac it is only 2 GB. Please change the memory allocation to 4 GB in the Docker settings and try again.
I am unable to get the daemon running. I executed the following command:
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=pwdppp123' -p 1433:1433 -d microsoft/mssql-server-linux
but the command executes and then exits.
When I do a:
docker ps
I do not see the container running. How do I fix this?
I am using MacOS X.
uname -a yields:
Darwin MacBook-Pro.local 16.6.0 Darwin Kernel Version 16.6.0: Wed Apr 12 21:00:08 PDT 2017; root:xnu-3789.60.20.0.1~3/RELEASE_X86_64 x86_64
@srueff - Sorry about that. we missed a merge in the build process. We'll update the image with tools tomorrow. RE: the SSMS issue, probably better if you file an issue on the mssql-docker GitHub so we can have a threaded conversation there. Let us know what error message you are getting.

