Skip to content

Files

Latest commit

 

History

History

preview

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Introduction

There are five Linux-based Docker container images documented here:

  • A representation of the actual Dockerfile that is used by Microsoft to build the Ubuntu-based image mssql-server-linux which is available at Docker Hub.
  • A Dockerfile for building a CentOS-based image on your own
  • A Dockerfile for building a RHEL-based image on your own
  • A Dockerfile for building a SLES-based image on your own
  • A Dockerfile for building an openSUSE-based image on your own

Full documentation can be found at the SQL Server on Linux Docker image page.

Learn more about the latest release of SQL Server on Linux here: SQL Server on Linux Documentation.

mssql-server-linux

This Ubuntu-based image is built and maintened by Microsoft, and published on Docker Hub.

mssql-server-centos

To build a CentOS-based image

To build an image locally on your Docker host follow these steps:

$ cd linux/preview/CentOS
$ make
$ make test
$ make run

mssql-server-rhel

There is a Dockerfile on this project published for those that would like to build their own image based on the official Red Hat Enterprise Linux 7 image.

Prerequisites for building a RHEL-based image

  • You will need access to the Red Hat Container Catalog via a Red Hat subscription.
  • You will need to login to the Red Hat Container Catalog using docker login. More info
  • You will also need to provide your Red Hat subscription credentials in the Dockerfile before you build.
  • You will also need to build the image yourself using Docker's command line tool 'docker'.

To build a RHEL-based image

To build an image locally on your Docker host follow these steps:

$ cd linux/preview/RHEL
$ make
$ make test
$ make run

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 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.

Additional, optional environment variables are documented in the product documentation.

Current limitations


  • Mapping volumes to the host using 'docker run -v' is not supported for Docker for Mac. You can use data volume containers instead for data file persistence. Resolving this limitation is tracked as issue #12.

Feedback


  • For issues with or questions about these images or SQL Server on containers in general, please contact us through a GitHub issue.
  • This is not an official support channel. If you require support with SQL Server, please contact Microsoft Support through the standard channels.

Frequently asked questions


  • How do I map a volume using Docker for Windows? Make sure to enable shared drives in the settings menu. After that, you can map a volume specifying the Windows path:Linux path. The following is an example of a command to map a Windows folder to the data directory in the container:

docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=yourStrong(!)Password' -p 1433:1433 -v C:\MyWindowsVolume:/var/opt/mssql -d microsoft/mssql-server-linux

Further reading


Additional Microsoft SQL Server Docker images

Note: Developer Edition is a full-featured version of SQL Server without resource limits, but can only be used in dev/test. Express Edition is a resource-limited edition of SQL Server that can be used in production. Get more information on SQL Server Editions.