跳到主要內容

發表文章

目前顯示的是 11月, 2020的文章

[Python] Flask web in Docker- using pyodbc

 Python flask web run by Docker *using ODBC: The server need to install ODBC driver microsoft install odbc Copy  odbcinst.ini to container COPY odbcinst.ini /etc/odbcinst.ini The docker need to install odbc before pip install pyodbc RUN apt-get update && apt-get install -y --no-install-recommends \ unixodbc-dev \ unixodbc \ libpq-dev     vim  odbcinst.ini  , check odbc driver path, then run image setting volumn path docker run -v /opt/microsoft/:/opt/microsoft/ -p 5000:5000 ProjectName -Dockerfile: FROM python:3.7-rc RUN apt-get update && apt-get install -y --no-install-recommends \ unixodbc-dev \ unixodbc \ libpq-dev COPY odbcinst.ini /etc/odbcinst.ini RUN mkdir /TargetPath COPY ./Project /TargetPath # set environment variables ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 # set work directory WORKDIR /TargetPath # install dependencies RUN pip install --upgrade pip RUN pip install -r requirements.txt CMD [ "python"