Skip to content

flaky Build: Login failed for user 'SA' . Repeatable Test Included #748

@Warfront1

Description

@Warfront1

Running on a CircleCI Build Container(Linux Large): ubuntu-2004:202201-02

  • Ubuntu 20.04, Docker v20.10.12, Docker Compose v1.29.2

This issue occurs ~50% of the time when building with the provided Dockerfile on the above system:
docker build --no-cache --progress=plain --tag test

Error Message is always from the sqlcmd, providing the following error message:
Error: Microsoft ODBC Driver 17 for SQL Server : Login failed for user 'SA'..

The Dockerfile:

FROM mcr.microsoft.com/mssql/server:2017-CU29-ubuntu-16.04

# Create "errorlog" to prevent race conditions and Create test sql script
RUN mkdir -p "/var/opt/mssql/log/" && touch "/var/opt/mssql/log/errorlog" && \
  echo "select 1" > test.sql

# Create primary setup/test bash script
RUN echo '#!/bin/bash' >> ~/setup.sh && \
  echo 'until grep -Fq "SQL Server is now ready for client connections" /var/opt/mssql/log/errorlog; do sleep 1s; done' >> ~/setup.sh && \
  echo 'sqlcmd_output=$( (/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P P@nkM0n123 -i "test.sql") 2>&1) && echo "$sqlcmd_output"' >> ~/setup.sh && \
  echo 'if [[ "$sqlcmd_output" == *Error*  ]]; then echo "Error Running SQL Scripts during container build: $sqlcmd_output" && exit 1; fi' >> ~/setup.sh && \
  cat ~/setup.sh && chmod +x ~/setup.sh

ENV ACCEPT_EULA=Y
ENV MSSQL_SA_PASSWORD=P@nkM0n123

RUN /opt/mssql/bin/sqlservr --accept-eula & ~/setup.sh && pkill sqlserv

Note All data in the Dockerfile is test data; the password, and commands are just an MRE of the issue I am receiving.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions