I am trying to deploy a Flask Rest API on RHEL 7.3 LINUX machine using docker and got following error after building the Docker image and trying to run it.
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/pypyodbc.py", line 428, in
<module>
ODBC_API = ctypes.cdll.LoadLibrary('libodbc.so')
File "/usr/local/lib/python3.6/ctypes/__init__.py", line 426, in LoadLibrary
return self._dlltype(name)
File "/usr/local/lib/python3.6/ctypes/__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libodbc.so: cannot open shared object file: No such file or
directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "app.py", line 5, in <module>
import utils as u
File "/PYTHDEV/parquetfiles/utils.py", line 11, in <module>
import pypyodbc as db
File "/usr/local/lib/python3.6/site-packages/pypyodbc.py", line 440, in
<module>
raise OdbcNoLibrary('ODBC Library is not found. Is LD_LIBRARY_PATH set?')
pypyodbc.OdbcNoLibrary: 'ODBC Library is not found. Is LD_LIBRARY_PATH
set?'
Below is my Docker file. Am I missing something?
#Pull base image
FROM python:3.6
#Define working directory
WORKDIR /PYTHDEV/parquetfiles
#Build Commands
#RUN cd /PYTHDEV/
#RUN mkdir pq_flask_api
ADD requirements.txt /PYTHDEV/parquetfiles
RUN pip install -r /PYTHDEV/parquetfiles/requirements.txt
ADD . /PYTHDEV/parquetfiles
RUN PATH="/opt/mssql-tools/bin:/etc/:$PATH"
RUN LD_LIBRARY_PATH="/opt/mssql-tools/bin:/etc/:$PATH"
#Define default commands
EXPOSE 5000
CMD ["python3", "app.py"]