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
- 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
- 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
There are no tools installed inside the container for now. You can connect to the SQL Server instance 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.
- ACCEPT_EULA confirms 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.
- For issues with or questions about this image, please contact us through a GitHub issue.
Thank You! It Works!
I am this sqlserver image with docker-compose. I randomly get the below error.
java.lang.RuntimeException: java.sql.SQLException: Cannot create PoolableConnectionFactory (The TCP/IP connection to the host sqlserver, port 1433 has failed. Error: "Connection refused. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".)
It fixes itself after couple of restarts, but bothers me as I have to re run my failed Travis job.
Has anyone experienced the same ?
Please also add environment variables for creation of initial User + Password, so sa-user does not need to be used.
@paigeadele try to use SqlConnectionStringBuilder. Initially i put my connectionstring on appsettings.json as usual. But i didn't work. https://www.microsoft.com/en-us/sql-server/developer-get-started/csharp-ubuntu
Here's my working code.
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
builder.DataSource = "db"; // update me
builder.UserID = "sa"; // update me
builder.Password = "Passw0rd"; // update me
builder.InitialCatalog = "testdb";
I'm new to docker, so I don't know if I'm doing it right, but when I start the mssql-server-linux container with a mapped drive for config files and databases on windows, and then try to restore a database, it crashes. Is it just me?
Cannot connect to 192.168.1.20.
Login failed for user 'sa'. (.Net SqlClient Data Provider)
Server Name: 192.168.1.20
Error Number: 18456
Line Number: 65536
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource
1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource
1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource1 retry)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at Microsoft.SqlServer.Management.SqlStudio.Explorer.ObjectExplorerService.ValidateConnection(UIConnectionInfo ci, IServerType server)
@ante5273 - Glad to hear you got it working!
I managed to run mssql successfully using azure file.
I explained my test method and environment on the following link.
The only problem that i see at this moment, it takes 10-15 mins to go online after i started the mssql container.
@twrightmsft - When the container crashed, i collected the following error message using "docker log"
It seem that there were connection or access problem between docker container and azure file share. because i specified to load "/var/opt/mssql" directory from azure file share.
paltelemetry: Loading the directory /var/opt/mssql/.system/.system/telemetry failed. Errno 
This is an evaluation version. There are  days left in the evaluation period.
2017-01-28 04:43:31.04 Server Microsoft SQL Server vNext (CTP1.2) - 184.108.40.206 (X64)
Jan 10 2017 19:15:28
Copyright (C) 2016 Microsoft Corporation. All rights reserved.
on Linux (Ubuntu 16.04.1 LTS)
2017-01-28 04:43:31.04 Server UTC adjustment: 0:00
2017-01-28 04:43:31.04 Server (c) Microsoft Corporation.
2017-01-28 04:43:31.04 Server All rights reserved.
2017-01-28 04:43:31.05 Server Server process ID is 4116.
2017-01-28 04:43:31.05 Server Logging SQL Server messages in file 'C:\var\opt\mssql\log\errorlog'.
2017-01-28 04:43:31.05 Server Registry startup parameters: