Mssql-docker: Microsoft ODBC Driver 13 for SQL Server : Login failed for user 'SA'

Created on 17 May 2017  路  12Comments  路  Source: microsoft/mssql-docker

Hi:
Hi Run

docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Tt@12345' -p 1433:1433  --name mssql  -v  /data/mssql/log:/var/opt/mssql  microsoft/mssql-server-linux

and change the password 

docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'Tt@12345' -Q 'ALTER LOGIN SA WITH PASSWORD="P@ss0wrd"

console show :
```
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login failed for user 'SA'..

sa default password is ?

Most helpful comment

I have the same issue. I stopped and removed all containers and deleted all data. The problem remains. In the log file I see:
2017-05-18 11:42:46.48 Logon Login failed for user 'sa'. Reason: An error occurred while evaluating the password. [CLIENT: 172.17.0.2]

UPDATE: I found the issue, I am using Docker on Windows and I had to use double quotes (") instead of single quotes ('). After that, everything worked!

All 12 comments

Is it possible that you created the container with the -v volume mount with a different password and then created a new container with the same -v volume mount with the password above? The first time you create a container the master DB files will be created in the -v volume mount directory and the SA password will be stored in the master DB. If you create a new container and point to the same -v volume mount then the _existing_ master DB's SA password will be in effect and the SA_PASSWORD that you pass in will be ignored. See this issue for a description of this problem.

https://github.com/Microsoft/mssql-docker/issues/89

Suggestion: If you dont care about the DBs previously created, stop all containers, remove all containers, delete the contents of /data/mssql/log on your host and start over.

I have the same issue. I stopped and removed all containers and deleted all data. The problem remains. In the log file I see:
2017-05-18 11:42:46.48 Logon Login failed for user 'sa'. Reason: An error occurred while evaluating the password. [CLIENT: 172.17.0.2]

UPDATE: I found the issue, I am using Docker on Windows and I had to use double quotes (") instead of single quotes ('). After that, everything worked!

Closing out. Reopen please if needed.

I have the same issue when working with docker-compose. I have the compose file which defines the password using environment for sql server as below

environment:
 SA_PASSWORD: "strongpassword"
 ACCEPT_EULA: "Y"

However it always showing "Login failed for user 'sa'. Reason: An error occurred while evaluating the password. [CLIENT: 172.18.0.3]" error message.

I don't use any mounted volume and the container/images are all removed and re-created every time.

The literal "strongpassword" does not conform to Microsofts password policies.

"strongpassword" is just placeholder. The actually password definitely complies with the policies.

I get the same message in docker container on MacBook Pro sierra , I have used everything correctly.

I'm getting the same error "Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login failed for user 'SA'. On MacBook Pro High Sierra.

If I run the container from the command line it is working perfectly but when I try to run from visual studio docker compose, it gets to run and getting the show in cmd. But giving the following error
"Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login failed for user 'SA'"

docker compose code is as follow

version: '3.4'

services:
webapplication1:
image: ${DOCKER_REGISTRY-}webapplication1
build:
context: .
dockerfile: WebApplication1/Dockerfile
depends_on:

  • "db"
    networks:
  • app-network

db:
image: microsoft/mssql-server-linux
environment:
sa_password: "Thingtrax#1"
MSSQL_PID: "Express"
ACCEPT_EULA: "Y"
ports:

  • "7002:1433"
    networks:
  • app-network

networks:
app-network:
driver: bridge

I am using windows 10 pro.Docker version 18.09.0, build 4d60db4
Already i have removed all the containers
Please help me to solve this issue

Same issue here..

@EAbychkov are you facing same issue as i am.
So i have solved it

Finally, I got the solution, I was needed to add:
-e 'MSSQL_PID=Enterprise'

And the overall command:
docker run -p 1433:1433 -v "c:\programdata\docker\volumes\sqldata:/var/opt/mssql" --name sql1 -e "SA_PASSWORD=1Q2w3e4r5t6y&U" -e 'MSSQL_PID=Enterprise' -e "ACCEPT_EULA=Y" -d microsoft/mssql-server-linux:latest

Was this page helpful?
0 / 5 - 0 ratings