Public Repository

Last pushed: 9 days ago
Short Description
Official images for Microsoft SQL Server on Linux for Docker Engine.
Full Description

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.

Additional Microsoft SQL Server Docker Images


  • 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
    • 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 script to do things like create databases or logins, attach databases, import data, or other setup tasks. See this example of using an 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 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.

User Feedback

  • For issues with or questions about this image, please contact us through a GitHub issue.

Further Reading

Docker Pull Command

Comments (87)
9 days ago

Heads up everybody! :latest (CTP 1.4) now include the mssql-tools package in the image. Now you can easily use sqlcmd or bcp without having to separately install them.

10 days ago

We've rebuilt our mssql-server-linux image with mssql-tools. One can find here

10 days ago


This will be shipped within the next few monthly releases. This is tracked in the following issue:


10 days ago

@ joeltrancon

Created an issue to follow this ask:


13 days ago

I'd love to see a build with Full-Text Search optional package included.


a month ago

Thank You! It Works!

a month ago

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 ?

a month ago

Please also add environment variables for creation of initial User + Password, so sa-user does not need to be used.

a month ago

@paigeadele try to use SqlConnectionStringBuilder. Initially i put my connectionstring on appsettings.json as usual. But i didn't work.

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";
return builder.ConnectionString;

a month ago

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?