首页 > 数据库技术 > 详细

Docker下安装Sqlserver(mssql)

时间:2020-04-29 16:50:47      阅读:316      评论:0      收藏:0      [点我收藏+]

1.服务器需要大于2G内存。如果不够则可能无法正常启动,查看日志报如下错误:
This program requires a machine with at least 2000 megabytes of memory

技术分享图片

 

 

2.获取sqlserver镜像

docker pull mcr.microsoft.com/mssql/server:2017-latest

镜像下载成功后,运行镜像

docker run -e ACCEPT_EULA=Y -e MSSQL_PID="Developer" -e MSSQL_SA_PASSWORD="sa" -e MSSQL_TCP_PORT=1234 -p 1234:1234 --name sqlserver -d mcr.microsoft.com/mssql/server:2017-latest

 

运行容器报错:
SQL Server 2019 will run as non-root by default.
This container is running as user root.
To learn more visit https://go.microsoft.com/fwlink/?linkid=2099216.
The SQL Server End-User License Agreement (EULA) must be accepted before SQL
Server can start. The license terms for this product can be downloaded from
http://go.microsoft.com/fwlink/?LinkId=746388.

You can accept the EULA by specifying the --accept-eula command line option,
setting the ACCEPT_EULA environment variable, or using the mssql-conf tool.

 3.登录sqlserver容器

docker exec -it sqlserver "bash"

4.连接sqlserver

/opt/mssql-tools/bin/sqlcmd -S localhost,1234 -U SA -P Lc19951127.

技术分享图片

 

 技术分享图片

 

 

5.执行sql

 

英文的操作系统  对于有中文的  我定义类型  nvarchar(100)  

插入时:
insert into users values(N‘张三‘);
go

 技术分享图片

 

 这个是docker for windows 安装的,接下来我会去mac里具体使用

 

参考:https://docs.microsoft.com/zh-cn/sql/linux/sql-server-linux-configure-docker?view=sql-server-2017

Docker下安装Sqlserver(mssql)

原文:https://www.cnblogs.com/LiChen19951127/p/12802965.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!