Installation Prerequisites:
? Suitable for 1.8 or more of the Docker engines supported by the any Linux distribution, or Docker for Mac/windows. For more information, see Install Docker (installing Docker).
? At least 2 GB of disk space
? At least 2 GB of RAM
? System requirements for SQL Server on Linux.
Docker version: Install slightly
To view version commands:
Docker version
Request and run a container image
Pull the SQL Server Linux container image out of the Docker Hub.
Search Image:
[email protected] ~]# Docker search Mssql-server
Pull Image:
Docker Pull Microsoft/mssql-server-linux
Docker runs the container image, using the following command:
[[email protected] ~]# Docker run--name mssql-it-e ' accept_eula=y '-e ' sa_password=mypass!1 '-p 1433:1433-d microsoft/ Mssql-server-linux
To view whether the Mssql-server port is enabled or not:
View Mssql-server running status in a container
Enter the Docker container
[[email protected] ~]# Docker exec-it MSSQL Bash
Connect the Mssql-server server via the MSSQL client:
[Email protected]:/#/opt/mssql-tools/bin/sqlcmd-s localhost-u sa–p
View the following database:
To create a database:
Create DATABASE MyDB;
Select name from sys.databases;
Go
The test uses other client joins to access the Mssql-server database:
Docker ip:172.17.0.2
Sqlcmd-s 172.17.0.2-u Sa-p
1> select name from sys.databases;
2> Go
Create a test table in the MyDB database:
To switch databases:
1> Use MyDB
2> Go
Create a table Jwenshan
1> CREATE TABLE Jwenshan (id int,name nvarchar (20));
2> Go
Insert a piece of data into the table:
1> INSERT into Jwenshan values (1001, ' Jerry ');
2> Go
View below:
1> select * from Jwenshan;
2> Go
Mssql-server on Docker