Docker Community Forums

Share and learn in the Docker community.

Container not working after upgrade to Dokcer Engine 19.03.1, works fine in Engine 18.09.2

Have a container running python with pyodbc that connect to a Microsoft SQL Server (Microsoft SQL Server 2017 (RTM-CU14-GDR) (KB4494352) - 14.0.3103.1 (X64)).

It has been working fine on Docker Desktop and Engine version 18.09.2. But after upgrade to Docker Desktop and Engine 19.03.1 it has stopped working. I get a time out error from pyodbc, so it seems like a connection problem to the database. When I downgrade Docker everything works fine again. Does anybody know about any changes in Engine 19.03.1 that can be the reason for this?

Error from python:

Traceback (most recent call last):
  File "", line 17, in <module>
    cnxn = pyodbc.connect(login_info)
pyodbc.OperationalError: ('HYT00', '[HYT00] [Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired (0) (SQLDriverConnect)')


FROM python:3.7.4-stretch

# --- Install pyodbc on Derbian Stretch 9


RUN apt-get update \

# && apt-get install g++ \

&& apt-get install --yes unixodbc-dev \

&& pip install pyodbc==4.0.27

# --- Install Microsoft ODBC Driver


RUN curl | apt-key add -

RUN curl > /etc/apt/sources.list.d/mssql-release.list

# Need some certificate fix to install msodbcsql17

RUN apt-get install --yes apt-transport-https ca-certificates \

&& apt-get update && ACCEPT_EULA=Y apt-get install --yes msodbcsql17

Python script:

import pyodbc

login_info = f"""\
    DRIVER={{ODBC Driver 17 for SQL Server}};

cnxn = pyodbc.connect(login_info)
cursor = cnxn.cursor()

tsql = "SELECT @@version;"
with cursor.execute(tsql):
    row = cursor.fetchone()

docker command:

docker build --tag=pyodbc .
docker run --rm -v %cd%:/usr/src/ -w /usr/src pyodbc python