虚拟机安装docker安装sqlserver和mysql

centos7

首先注意虚拟机内存要大于2G!建议设置为4G,否则安装sqlserver报错!磁盘建议40G

vi /etc/sysconfig/network-scripts/ifcfg-e
onboot=yes
service network restart

解决ssh访问linux虚拟机特别慢
vi /etc/ssh/sshd_config
配置文件中的UseDNS设置为yes,修改为no。
service sshd restart

systemctl stop firewalld.service 关闭运行的防火墙
systemctl disable firewalld.service 永久关闭防火墙

yum install -y net-tools

curl -fsSL https://get.docker.com -o get -docker.sh
sh get-docker.sh – mirror Aliyun
systemctl start docker

docker pull microsoft/mssql-server-linux
docker run -e “ACCEPT_EULA=Y” -e “SA_PASSWORD=Sql@123456” -p 1433:1433 --name sqlserver -d microsoft/mssql-server-linux
–docker logs sqlserver

docker exec -it sqlserver “bash”
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P ‘Sql@123456’

127.0.0.1,1433
sa
Sql@123456

docker pull mysql:5.7
docker run -p 3306:3306 --name mysql -e MYSQL_ROOT_PASSWORD=root -d mysql:5.7
docker exec -it mysql /bin/bash
mysql -uroot -proot
ALTER USER ‘root’@’%’ IDENTIFIED WITH mysql_native_password BY ‘root’;

自动启动
systemctl enable docker.service
docker容器设置自动启动,启动时加–restart=always,如果已经启动的项目,则使用update --restart=always

你可能感兴趣的:(Java)