[Microsoft][ODBC Driver 17 for SQL Server]SSPI Provider: No Kerberos credentials available

Viewed 1138

I have developed Django app and connecting remote sql server from Django app. If I run it in anaconda environment its running fine, but if I build docker container it gives me error

sqlalchemy.exc.DBAPIError: (pyodbc.Error) ('HY000', '[HY000] [Microsoft][ODBC Driver 17 for SQL Server]SSPI Provider: No Kerberos credentials available (default cache: FILE:/tmp/krb5cc_0) (851968) (SQLDriverConnect)') (Background on this error at: http://sqlalche.me/e/dbapi)

Here is Dockerfile

FROM python:3

ENV PYTHONUNBUFFERED 1

WORKDIR /app

ADD . /app

COPY ./requirements.txt /app/requirements.txt



RUN apt-get update \
  && apt-get -y install gcc gnupg2 \
  && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
  && curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list

RUN apt-get update \
  && ACCEPT_EULA=Y apt-get -y install msodbcsql17 \
  && ACCEPT_EULA=Y apt-get -y install mssql-tools


RUN apt-get -y install unixodbc-dev \
  && apt-get -y install python-pip \
  && pip install pyodbc


RUN pip install --upgrade pip
RUN pip install Django
RUN pip install python-dotenv
RUN pip install --user django-crispy-forms
RUN pip install pandas
RUN pip install SQLAlchemy
RUN pip install django-pyodbc-azure-2019

COPY . /app

Here is the connection

engine = create_engine('mssql+pyodbc://' + 'SQLserver' + '/' + 'database' + "?" + 'driver=ODBC Driver 17 for SQL Server')

0 Answers
Related