Public Repository

Last pushed: 2 months 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 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.


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

Docker Pull Command

Comments (116)
4 days ago

@hansmeier You're probably using an old build. Until GA, the images are time-bombed and will expire after 180 days. Upgrading to a more recent tag like rc2 should fix your error.

11 days ago

What licencing applies to this? per core as per normal MSSQL costs?
If so, will there be an express version for Linux?

12 days ago

Always giving me this error:
Configuring Microsoft(R) SQL Server(R)...
Error: The evaluation period has expired.
/opt/mssql/bin/ line 108: 11 Aborted SQLSERVR_SA_PASSWORD_FILE=<(echo -n "$SA_PASSWORD") /opt/mssql/bin/sqlservr --setup $sqlservr_setup_options 2>&1 > /var/opt/mssql/log/setup-$(date +%Y%m%d-%H%M%S).log
Microsoft(R) SQL Server(R) setup failed with error code 134. Please check the setup log in /var/opt/mssql/log for more information.

13 days ago

@gugawag - When restoring a backup on Linux that was originally created on Windows, you need to do a restore WITH MOVE. See example here:

20 days ago


I've tried to restore a SQLServer backup (.bak file):
restore database SISTEMA_ACADEMICO from disk='/tmp/sistema_academico.bak'

but after this command an error occurred:
2> GO
Msg 5133, Level 16, State 1, Server dfb661eb66fa, Line 1
Directory lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\SISTEMA_ACADEMICO.MDF" failed with the operating system error 2(The system cannot find the file specified.).
Msg 3156, Level 16, State 3, Server dfb661eb66fa, Line 1
File 'SISTEMA_ACADEMICO' cannot be restored to 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\SISTEMA_ACADEMICO.MDF'. Use WITH MOVE to identify a valid location for the file.
Msg 5133, Level 16, State 1, Server dfb661eb66fa, Line 1
Directory lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\SISTEMA_ACADEMICO_log.LDF" failed with the operating system error 2(The system cannot find the file specified.).

Look that the sqlcmd is trying to restore the backup in a Windows folder structure, but naturally the Linux docker does not have.

How can I restore this kind of backup?
Thank you!

a month ago

@matheussouza, @krydab - have a look at the log files in the container at /var/opt/mssql/log/errorlog. If you need further help please file an issue on mssql-docker:

a month ago

@jorgearteiro - RE: Some things like agent, integration services, full text search work on SQL Server on Linux but they are not included in the mssql-server-linux. See this issue discussion for more details. Other components like reporting services and analysis services are not yet available on Linux at all. There is not a concrete plan for when or if those would come to Linux yet. If this is an interesting scenario to you please let us know!

a month ago

@jamesdudley - yes sqlpackage was temporarily removed. See the discussion on this issue:

a month ago

@basse - further, all XPs are disable on SQL Server on Linux for now for security reasons. We will likely enable some of the scenarios like "xp_cmdshell" for agent in a future release. We want to give you the ability to execute bash scripts as part of the agent, but there is some work we need to do there to be able to do that securely.

a month ago

@basse - Agent is not included in the mssql-server-linux image. If you want to have Agent or any of the other optional components you'll need to build your own image that has the components that you want. See this issue on GitHub for discussion about this: