使用docker后的python程序怪异行为

时间:2019-07-12 12:05:19

标签: python docker environment-variables pyodbc eve

我已经在python eve框架中编写了一个API。最终尝试使用docker处理多个请求。但是,我得到了error。该解决方案建议我创建一个(?'AA'[0-9])(\g{AA}),并使用this向其中添加一些行。最终,使用建议的解决方案构建docker并没有解决我的问题,因此我决定暂时删除代码的docker部分。当我删除docker部分时,代码运行异常,花费了很多时间来启动eve服务器,最后甚至抛出诸如environment.yml之类的错误。

现在,代码的行为不同于dockerization之前的行为。我觉得这是因为我使用了环境文件。而且,我意识到删除文件后可能就是问题所在。

docker文件内容:

AttributeError: 'NoneType' object has no attribute 'cursor'

environment.yml内容:

# Use an official Python runtime as a parent image
FROM python:3.7

# Set the working directory to /app
WORKDIR /app

# Copy the current directory contents into the container at /app
COPY . /app

# Install any needed packages specified in requirements.txt
RUN pip install --trusted-host pypi.python.org -r requirements.txt

# Make port 80 available to the world outside this container
EXPOSE 80

# Define environment variable
ENV NAME World

# Run app.py when the container launches
CMD ["python", "main.py"]

有什么办法设置此权限?

感谢您的帮助。

0 个答案:

没有答案