I installed docker and I run this command in windows
docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=MyComplexPassword!234" -e "MSSQL_PID=sa" --cap-add SYS_PTRACE -p 1404:1433 -d microsoft/mssql-server-linux
then I donwloaded SQL Server 2012 and in the server name I write localhost and in login : sa password as you can see in the installation command.
but I get the error SQL Server login failed for user.
What is wrong?
The issue is your using localhost. Which not the interface where docker is listening
PS C:\> ipconfig
Windows IP Configuration
Ethernet adapter vEthernet (Temp Nic Name):
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::99d:bf5e:8700:56df%26
IPv4 Address. . . . . . . . . . . : 172.27.219.121
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Default Gateway . . . . . . . . . : 172.27.208.1
If you a ipconfig
there would be a vEthernet
interface. And a IP would be there. Use this IP to connect to the your DB server. Also make sure to provide the port # as 1404
while connecting
With -p 1404:1433
you mapped machine port "1404" to docker's default SQL Server port "1433". So your "Server Name" in SSMS should be localhost,1404
instead of simply localhost
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.