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
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.
- 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.
- For issues with or questions about this image, please contact us through a GitHub issue.
- SQL Server on Linux for Docker documentation.
- SQL Server - Developer Getting Started Tutorials.
- SQL Server Docker GitHub Repository
@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.
What licencing applies to this? per core as per normal MSSQL costs?
If so, will there be an express version for Linux?
Always giving me this error:
Configuring Microsoft(R) SQL Server(R)...
Error: The evaluation period has expired.
/opt/mssql/bin/sqlservr.sh: 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.
@gugawag - When restoring a backup on Linux that was originally created on Windows, you need to do a restore WITH MOVE. See example here: https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-migrate-restore-database
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:
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?
@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: https://github.com/Microsoft/mssql-docker
@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.https://github.com/Microsoft/mssql-docker/issues/27 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!
@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.
@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: https://github.com/Microsoft/mssql-docker/issues/27