Mssql-server on Docker

Source: Internet
Author: User
Tags mssql mssql client server port docker for mac docker hub docker run

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.