Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy MSSQL in a Docker container

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Today, the editor will share with you the relevant knowledge points about how to deploy MSSQL in the Docker container. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

Deployment of MSSQL requires 2 gigabytes of memory

1. Download image docker pull microsoft/mssql-server-linux

Use this command to download the docker image of the database.

two。 Create and run container docker run-- name MSSQL_1433-m 512m-e 'ACCEPT_EULA=Y'-e' SA_PASSWORD=yourStrong (!) Password'-p 1433 ACCEPT_EULA=Y' 1433-d microsoft/mssql-server-linux

This password requires a complex password, with case and special symbols. Just replace yourStrong (!) Password with your own password. If you only have Linux servers, you can use host mode directly without port mapping

Docker run-- name MSSQL_1433-m 512m-e 'ACCEPT_EULA=Y'-e' SA_PASSWORD=yourStrong (!) Password'-- net=host-d microsoft/mssql-server-linux3. Log in to container docker exec-it MSSQL_1433 / bin/bash4. Connect to sqlcmd/opt/mssql-tools/bin/sqlcmd-S localhost-U SA-P 'yourStrong (!) Password'5. Execute the SQL statement to create the database CREATE DATABASE testDBgo6. Restore the database

Create a folder in the container first

Mkdir / var/opt/mssql/backup

Copy the .bak backup file to the container at the host

Sudo docker cp / Users/front/Downloads/beifen.bak MSSQL_1433:/var/opt/mssql/backup

Run sqlcmd into the list container of the logical file name and the path within the backup

Sudo docker exec-it MSSQL_1433 / opt/mssql-tools/bin/sqlcmd-S localhost-U SA-P'yourStrong (!) Password'-Q 'RESTORE FILELISTONLY FROM DISK = "/ var/opt/mssql/backup/beifen.bak" | tr-s' | cut-d''- f 1-2 is all the content of the article "how to deploy MSSQL in a Docker container". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report