You could earn up to $300 by adding new articles!

Get Started Now

Get Started With SQL Server 2017 (MS-SQL) on CentOS 7 With Docker

Published on: Mon, Jan 8, 2018 at 1:35 pm EST


  • Docker engine 1.8+.
  • Minimum of 4GB of disk space.
  • Minimum of 4GB of RAM.

Step 1. Install Docker

In order to install SQL-Server, Docker must be installed first.

If you have already installed Docker, you can skip this step.

In the terminal, type the following command. It is recommended that the command be run as root.

# curl -s | sudo sh

Verify that the installation is complete.

# docker version

If you get the output: Cannot connect to the Docker daemon. Is the docker daemon running on this host?, run Docker with the command below.

# service docker start

Then enter the following command to automatically start Docker at boot time.

# systemctl enable docker

Step 2. Install SQL-Server

You can install SQL-Server with the following command.

# docker run --restart always -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=YourStrongP@SSW0RD' -e 'MSSQL_PID=Developer' -p 1433:1433 --name SQL_CONTAINER -d microsoft/mssql-server-linux

See below for an in-depth description of what this command is doing.

  • --restart always - If, for any reason, the container is terminated, this will automatically restart it.

  • -e 'ACCEPT_EULA=Y' - This is a parameter that prompts you to accept the End User License Agreement. If you do not agree, the installation will not proceed.

  • -e 'MSSQL_SA_PASSWORD=YourStrongP@SSW0RD' - Be sure to change YourStrongP@SSW0RD in this command to a password of your choice for the SA account. The length must be at least 8 digits and must include at least three of the following: uppercase (A-Z), lowercase (a-z), numeric (0-9) and/or special characters.

  • -e 'MSSQL_PID=Developer' - This is a parameter to enter the license and product key. It can be used with Evaluation, Developer, Express, Web, Standard, Enterprise or ##### - ##### - ##### - ##### - ##### (where # is a letter or number).

  • -p 1433:1433 - This parameter specifies port forwarding. The first 1433 specifies the port to be used externally, and the second 1433 specifies the port in Docker.

  • --name SQL_CONTAINER - Specifies the name of the container.

  • -d microsoft/mssql-server-linux - An image of a container. If not specified, by default, it will install with the latest version.

Want to contribute ?

You could earn up to $300 by adding new articles!

Get started in the SSD Cloud!