Sign inSign up

pulla/mssql-server-windows-developer-fti

By pulla

Updated over 4 years ago

Microsoft SQL Server 2017 Developer Edition with Full-Text Index installed.

Image
0

3.3K

pulla/mssql-server-windows-developer-fti repository overview

Content

Image for Microsoft SQL Server 2017 Developer Edition including Full-Text Index enabled based on Windows Server Core 20H2 (SAC). This image is a fork from Microsoft/mssql-docker on GitHub and was extended to support Full-Text Index.

This image is compatible with Windows Server 2016 and Windows 10.

How to use this image

Before you start

Make sure you have Windows ready for Docker hosting. For further information read this.

How to configure

SA_PASSWORD (mandatory)

When creating a container a password needs to be provided. The password must be strong and full-fill sql server password policy (e.g. a GUID ;-) ). Regarding password policy have a look at Password Policy

All samples here use following valid default password: Password123

ATTACH_DBS (optional)

Attach a set of databases to the server automatically when creating the container. The set is configured in JSON. This parameter must be used in combination to -v to mount the physical database location.

[
   {
 	'dbName': 'SampleDB', 
 	'dbFiles': ['c:\\databases\\SampleDB.mdf', 'c:\\databases\\SampleDB.ldf']
   },
  ...
]
  • dbName: The name of the database
  • dbFiles: Database files within the container.
RESTORE_DBS (optional)

Restore a set of database backups to the server automatically when creating the container. The set is configured in JSON. This parameter must be used in combination to -v to mount the physical backup location.

[
   {
 	'dbName': 'SampleDB', 
 	'dbBackup': 'C:\\databases\\SampleDB.bak',
 	'dbLocation': 'C:\\databases\\'
   },
  ...
]
  • dbName: The name of the database
  • dbBackup: The location of the backup within the container
  • dbLocation: Specifies the location within the container where database files of the backup should be relocated

Get started

To create a new container run the following command:

docker run -e "SA_PASSWORD=Password123" -p 1533:1433 -d --name mssql-fti pulla/mssql-server-windows-developer-fti:4

Create a new container and attach a database (e.g. database 'SampleDB' exists at c:\databases):

docker run -e "SA_PASSWORD=Password123" -v "c:/databases/:c:/databases/" -e "ATTACH_DBS=[{'dbName':'SampleDB','dbFiles':['c:\\databases\\SampleDB.mdf','c:\\databases\\SampleDB_log.ldf']}]" -p 1533:1433 -d --name mssql-fti pulla/mssql-server-windows-developer-fti:4

Create a new container and restore a backup of a database (e.g. backup exists at c:\databases):

docker run -e "SA_PASSWORD=Password123" -v "c:/databases/:c:/databases/" -e "RESTORE_DBS=[{'dbName':'SampleDB','dbBackup':'C:\\databases\\SampleDB.bak', 'dbLocation':'C:\\databases\\'}]" -p 1533:1433 -d --name mssql-fti pulla/mssql-server-windows-developer-fti:4

To connect to the server you can use e.g. SQL Server Management Studio. For an app the connectionstring should look like this:

Connectionstring for container: Data Source=localhost,1533; User Id=sa; pwd=Password123;

Known Issue when connection with SQL Server Management Studio:

A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.) (Microsoft SQL Server, Error: -2146893019)

The certificate chain was issued by an authority that is not trusted.

In this case take a look at this conversation.

Some useful commands

Show running containers

docker ps

Show all containers

docker ps -a

Start a container

docker run mssql-fti

Stop a container

docker stop mssql-fti

Delete a container

docker rm mssql-fti

Show all images from the local repository

docker images

Delete an image

docker rmi pulla/mssql-server-windows-developer-fti:2

The ip address of the server can be obtained by this:

docker inspect --format '{{.NetworkSettings.Networks.nat.IPAddress}}' mssql-fti

View logs for trouble shooting:

docker logs mssql-fti

Connect to the container via sqlcmd and list databases:

sqlcmd -U sa -P Password123 -S localhost,1533
[1] SELECT name FROM master.sys.databases
[2] GO
[3] QUIT

Execute sqlcmd within the container and list databases:

docker exec mssql-fti sqlcmd -q "SELECT name FROM master.sys.databases"

Run Powershell in interactive mode in the container:

docker exec -i mssql-fti powershell

Restore a database from backup within the container. Note: c:\databases is mounted to the container.

docker exec mssql-fti sqlcmd -q "RESTORE DATABASE SampleDB FROM DISK = 'c:\databases\SampleDB.bak'"

Backup a database to disc:

docker exec mssql-fti sqlcmd -q "BACKUP DATABASE SampleDB TO DISK = 'c:\databases\SampleDB.bak'"

Supported Tags

  • 6 (switch to Windows Server Core 2022 LTSC)
  • 5 (switch to Windows Server Core 20H2 SAC)
  • 4 (switch to Windows Server Core 2019 LTSC)
  • 3 (support restoring backups)
  • 2 (support attaching databases)
  • 1 (initial version)


Tag summary

Content type

Image

Digest

Size

2.8 GB

Last updated

over 4 years ago

docker pull pulla/mssql-server-windows-developer-fti:6