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
# curl -s https://get.docker.com/ | 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
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
##### - ##### - ##### - ##### - ##### (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.