Everyone is familiar with SQL Server can be installed on the Windows system, I also introduced the SQL Server can be installed on Linux, then today I will introduce SQL Server installed on Docker as a container to quickly run up
First, you need to create a CentOS
Specify the virtual machine name, password, and resource group
Size I choose B2s
Configure the virtual machine's parameters, storage account, virtual network, and subnet, the virtual machine's public IP address is dynamic, network security group Open 22 port
Create a new diagnostic storage account
Create a virtual machine
Set a DNS resolution name on Azure for the virtual machine sqlondocker.eastasia.cloudapp.azure.com
Once the virtual machine is created, it can be logged in with SSH connection.
The same as the usual, first set the root password and switch to root login
Sudo passwd Root
[Enter Zjunsen password]
[Set root new password]
[Re-enter the settings root new password]
Su-
[Enter root password]
Next, install Docker
After the installation is complete, as is the demo, here I close the Seliinux and firewall
[Email protected] ~]# Vim/etc/selinux/config
[Email protected] ~]# Systemctl stop Firewalld
[Email protected] ~]# systemctl disable FIREWALLD
Restart the virtual machine, then log back in, switch to the root account, start the Docker service, and see if the Docker service is running properly
OK, everything is fine, next check the Docker version information Docker info or docker version, installing SQL Server on Docker requires the following three conditions
Docker engine requires more than 1.8 version, 4G or more memory, more than 4G of free disk space
Next search Dcoker to get those MSSQL images.
Obtain the SQL Server Container Imager image from the Docker hub because the mirror is a bit large, so you need to wait a while
After the download is complete, you can see that the image has 1.43G
The next step is to run the first Docker container and run SQL Server.
Docker run-e ' accept_eula=y '-e ' sa_password=[set SQL Server SA password]' -p [Specify a port on the virtual machine]: 1433-d microsoft/m Ssql-server-linux
Docker run-e ' accept_eula=y '-e ' sa_password=[email protected]'-P 7001: 1433-d microsoft/ Mssql-server-linux
This creates the first container.
The first SQL Server container can now be accessed through the 7001 port of the virtual machine.
Add a 7001 TCP inbound port to Azure
Next use the SQL Server Management Studio connection to access the test
It's connected.
Now that the SQL Server for the first container succeeds, I'll create 3 more containers to run SQL
[email protected] ~]# Docker run-e ' accept_eula=y '-e ' sa_password=[email protected]'-P 11433: 1433-d Microsoft/mssql-server-linux
[email protected] ~]# Docker run-e ' accept_eula=y '-e ' sa_password=[email protected]'-P 21433: 1433-d Microsoft/mssql-server-linux
[email protected] ~]# Docker run-e ' accept_eula=y '-e ' sa_password=[email protected]'-P 31433: 1433-d Microsoft/mssql-server-linux
In just a few seconds, 3 new containers running SQL are OK.
Remember to open these inbound ports on Azure for this virtual machine
Connect try
When the demo was finished, I started cleaning up the environment.
Stop all containers in stop
# Docker Stop $ (Docker ps-a-Q)
Removes all containers from remove
# Docker RM $ (Docker ps-a-Q)
Finally delete the mssql-server-linux image
Installing the Run SQL Server container on Docker is an introduction to this, and it feels like a few commands to quickly build a SQL database environment.
53.Azure in CentOS Docker install run SQL Server container