centos7 docker install sql server 2019

Contos7 installs sql server
docker minimum 1.8 or higher

卸载旧的docker
sudo yum remove docker
docker-client
docker-client-latest
docker-common
docker-latest
docker-latest-logrotate
docker-logrotate
docker-engine

Install docker dependent packages
#Install required resource packages
sudo yum install -y yum-utils
#Set docker download address
sudo yum-config-manager add-repo https://download.docker.com/linux/centos/docker-ce.repo

# install docker
sudo yum install docker-ce docker-ce-cli containerd.io

Check the installation status
yum list docker-ce --showduplicates | sort -r

Start the docker service
systemctl start docker

docker -v to see the version

Pull sql server 2019 image
docker pull mcr.microsoft.com/mssql/server:2019-latest


Prepare to mount the sql directory chmod -R 777 /docker_volume/mssql locally in Linux

Start the image
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Sa123456" -p 1433:1433 --name sql1 --hostname sql1 -d -v /docker_volume/mssql:/var/opt/mssql:Z mcr.microsoft.com/mssql/server:2019-latest

insert image description here

insert image description here

Docker exec –it 9e0d0bf05537 /bin/bash Enter the sql server Ls /var/opt/mssql in the docker container to check that the database files in the default container are all in this file location

You can test in the sql server container whether you can log in to
the sql server in the Docker container
mssql@sql1:/$ /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P Sa123456
1>

After entering, open the sql server agent, otherwise the manager studio will connect and display that the agent is closed, and automatic backup cannot be set.
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Agent XPs', 1;
GO
RECONFIGURE
GO

After the test in the container is OK, then download and install the sql server management studio management tool on another windows 7 or 10, and connect to the sql server
account SA
password Sa123456 in the container

docker update --restart=always 07ec49c5320a centos7 starts the sql in the container automatically

Guess you like

Origin blog.csdn.net/ydaxia110/article/details/131756670