I have configured docker with db on it
Here is how I download sql
docker pull microsoft/mssql-server-linux:2017-latest
Then I do this command
docker run -e "ACCEPT_EULA=Y" -e 'SA_PASSWORD=$cthulhu1988' -p 1433:1433 --name test -d microsoft/mssql-server-linux:2017-latest
and then I tried to connect to it via this command
docker exec -it test /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P '$cthulhu1988'
But I get this error
**Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login failed for user 'SA'..**
UPDATE
I make ipconfig
And tried to do this with my Ipv4 address
docker exec -it test /opt/mssql-tools/bin/sqlcmd -S 10.0.75.1 -U SA -P '$cthulhu1988'
Now I have this errors
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired. Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x102. Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..
I Cheched, tcp\\ip enabled
Where can be my mistake?
Your password does not appear to be the issue. I connected just fine and can't recreate the issue. Change your port mapping and try again:
docker run -e "ACCEPT_EULA=Y" -e 'SA_PASSWORD=$cthulhu1988' -p 1488:1433 --name test -d microsoft/mssql-server-linux:2017-latest
In my case, the password "$cthulhu1988" does not pass complexity validation. Instead of receiving an error, the container starts without any sign of an error. However, I can then no longer login as SA.
I stopped and removed my container, then re-created it with "docker run" but this time I changed the password to
1Secure*Password1
Now having a complexity-valid password, finally I am able to log in as SA.
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.