Login fails for SA sql server linux docker
Finally I got it to work:
docker run --name sqlserver --hostname sqlserver -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=1StrongPwd!!" -p 1433:1433 -d microsoft/mssql-server-linux:2017-latest
I guess it should be MSSQL_SA_PASSWORD and not SA_PASSWORD
The documentation isn't clear in that part...
Can't connect to ms sql database from docker container by sql management studio
As far as I understood, the issue was with an incorrect password to DB. The password didn't match to database rules. The correct password should contain
at least 8 characters long and contain characters from three of the following four sets: Uppercase letters, Lowercase letters, Base 10 digits, and Symbols ->
https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker?view=sql-server-2017&pivots=cs1-bash#pullandrun2017
Docker container can't connect to SQL Server on a remote server
This is most probably because of the connection string.
Change your connection string to something like below
Server=172.16.0.88\\SQL_DEV,64608;Database=MyProject;UserId=myuser;Password=mypassword
or
Server=172.16.0.88,64608;Database=MyProject;User Id=myuser;Password=mypassword
Which ever works.
Failed to connect to docker hosted MSSQL
I found out the problems after some trials and errors, and re-reading the documents. I should use double quotes for the arguments when I executed my command in PowerShell.
I was looking into the wrong direction. Initially I executed the command:
docker run -e 'ACCEPT_EULA=Y' --name mssql -e \
'SA_PASSWORD=yourStrong(!)Password' -p 1433:1433 -d \
microsoft/mssql-server-linux:latest
Container stopped automatically by itself every time it starts.
Then, I did some googling and found:
docker run -e 'ACCEPT_EULA=Y' --name mssql -e \
'SA_PASSWORD=yourStrong(!)Password' -p 1433:1433 -it -d \
microsoft/mssql-server-linux:latest /bin/bash
It seemed fine on the surface. It got executed successfully in PowerShell. It didn't stop automatically anymore.If I dig deeper using
docker container logs mssql
to see the log for mssql. No error given, just that I don't see a lots of info given, which led me to think that there were no problems in my command.
But the right way to run these commands is using double quotes.
Link: https://hub.docker.com/r/microsoft/mssql-server-linux/
IMPORTANT NOTE: If you are using PowerShell on Windows to run these commands use double quotes instead of single quotes.
E.g.
docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=YourStrong!Passw0rd" -p 1401:1433 --name sql1 -d microsoft/mssql-server-linux:2017-latest
I am also able to login using SSMS with:
- Server name: Hostip,1401
- Username: sa
- Password:yourpassword
Related Topics
Is There Any Boolean Type in Oracle Databases
Reference Alias (Calculated in Select) in Where Clause
Db2 Comma Separated Output by Groups
When No 'Order By' Is Specified, What Order Does a Query Choose For Your Record Set
Sqlite - How to Join Tables from Different Databases
Select/Group by - Segments of Time (10 Seconds, 30 Seconds, etc)
Get All Dates Between Two Dates in SQL Server
Can a Foreign Key Reference a Non-Unique Index
How to Restore a Dump File from MySQLdump
What Is Best Tool to Compare Two SQL Server Databases (Schema and Data)
Get All Table Names of a Particular Database by SQL Query
SQL Query: Delete All Records from the Table Except Latest N
Regex to Select Nth Value from a List, Allowing for Nulls