📜  docker mssql - Shell-Bash (1)

📅  最后修改于: 2023-12-03 15:30:31.765000             🧑  作者: Mango

Docker MSSQL - Shell/Bash

Introduction

Docker MSSQL is a containerized version of Microsoft SQL Server that allows developers to quickly spin up MSSQL instances. By using Docker, programmers can avoid time-consuming installation processes and instead focus on developing applications that require a MSSQL database.

Installation

To get started with Docker MSSQL, you must first install Docker on your machine. You can do this by following the instructions on the Docker website.

Once Docker is installed, you can pull the MSSQL docker image using the following command:

docker pull microsoft/mssql-server-linux
Usage

To start a MSSQL instance, run the following command:

docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=mySQLPa$$word' -p 1433:1433 -d microsoft/mssql-server-linux

This command starts a MSSQL instance with the following settings:

  • ACCEPT_EULA set to "Y" to acknowledge the license agreement
  • SA_PASSWORD set to "mySQLPa$$word" for the SA user's password
  • -p set to 1433 to map the container's port 1433 to the host port 1433
  • -d to run the container in detached mode
Connecting to MSSQL

To connect to the MSSQL instance running in the container, you can use your preferred MSSQL management tool (e.g., SQL Server Management Studio).

In the connection settings, enter the following information:

  • Server: localhost or 127.0.0.1
  • Port: 1433
  • Login: SA
  • Password: mySQLPa$$word
Conclusion

Using Docker MSSQL can be an effective way to get your development environment up and running quickly. By containerizing MSSQL, you can avoid conflicts with other software on your machine and easily share your database environment with your team. Give it a try!