$ sudo docker run -t imgcomparer6
unable to load configuration from app.py
if __name__ == '__main__':
app.run(host="127.0.0.1", port=int("8000"), debug=True)
FROM ubuntu:latest
#Update OS
RUN sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list
RUN apt-get update
RUN apt-get -y upgrade
# Install Python
RUN apt-get install -y python-dev python-pip
RUN mkdir /webapp/
# Add requirements.txt
ADD requirements.txt /webapp/
ADD requirements.txt .
# Install uwsgi Python web server
RUN pip install uwsgi
# Install app requirements
RUN pip install -r requirements.txt
# Create app directory
ADD . /webapp/
# Set the default directory for our environment
ENV HOME /webapp/
WORKDIR /webapp/
# Expose port 8000 for uwsgi
EXPOSE 8000
ENTRYPOINT ["uwsgi", "--http", "127.0.0.1:8000", "--module", "app:app", "--processes", "1", "--threads", "8"]
#ENTRYPOINT ["python"]
CMD ["app.py"]
目录结构
app.py
image_data.db
README.txt
requirements.txt
Dockerfile
templates
- index.html
static/
- image.js
- main.css
img/
- camera.png
images/
- empty
编辑:
Docker图像
castro@Ezri:~/Desktop/brian_castro_programming_test$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
imgcomparer6 latest d2af1b18ec87 59 minutes ago 430 MB
imgcomparer5 latest 305fa5062b41 About an hour ago 430 MB
<none> <none> e982e54b011a About an hour ago 430 MB
imgcomparer2 latest c7e3ad57be55 About an hour ago 430 MB
imgcomparer latest a1402ec1efb1 About an hour ago 430 MB
<none> <none> 8f5126108354 14 hours ago 425 MB
flask-sample-one latest 9bdc51fa4d7c 23 hours ago 453 MB
ubuntu latest 6a2f32de169d 12 days ago 117 MB
sudo docker logs imgcomparer6
Error: No such container: imgcomparer6
unable to load configuration from app.py
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.27/containers/json?limit=1: dial unix /var/run/docker.sock: connect: permission denied
"docker logs" requires exactly 1 argument(s).
See 'docker logs --help'.
Usage: docker logs [OPTIONS] CONTAINER
Fetch the logs of a container
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e80bfd0a3a11 imgcomparer6 "uwsgi --http 127...." 54 minutes ago Exited (1) 54 minutes ago musing_fermat
29c188ede9ba imgcomparer6 "uwsgi --http 127...." 54 minutes ago Exited (1) 54 minutes ago kind_jepsen
a58945d9cd86 imgcomparer6 "uwsgi --http 127...." 55 minutes ago Exited (1) 55 minutes ago musing_wright
ca70b624df5e imgcomparer6 "uwsgi --http 127...." 55 minutes ago Exited (1) 55 minutes ago brave_hugle
964a1366b105 imgcomparer6 "uwsgi --http 127...." 55 minutes ago Exited (1) 55 minutes ago clever_almeida
155c296a3dce imgcomparer6 "uwsgi --http 127...." 2 hours ago Exited (1) 2 hours ago jovial_heisenberg
0a6a3bb55b55 imgcomparer5 "uwsgi --http 127...." 2 hours ago Exited (1) 2 hours ago sharp_mclean
76d4f40c4b82 e982e54b011a "uwsgi --http 127...." 2 hours ago Exited (1) 2 hours ago kind_hodgkin
918954bf416a d73c44a6c215 "/bin/sh -c 'mkdir..." 2 hours ago Exited (1) 2 hours ago amazing_bassi
205276ba1ab2 d73c44a6c215 "/bin/sh -c 'mkdir..." 2 hours ago Exited (1) 2 hours ago distracted_joliot
86a180f071c6 d73c44a6c215 "/bin/sh -c '#(nop..." 2 hours ago Created goofy_torvalds
fc1ec345c236 imgcomparer2 "uwsgi --http 127...." 2 hours ago Created wizardly_boyd
b051d4cdf0c6 imgcomparer "uwsgi --http 127...." 2 hours ago Created jovial_mclean
ed78e965755c d73c44a6c215 "/bin/sh -c '#(nop..." 3 hours ago Created elated_shirley
a65978d30c8f d73c44a6c215 "/bin/sh -c '#(nop..." 3 hours ago Created vigilant_wright
760ac5a0281b d73c44a6c215 "/bin/sh -c '#(nop..." 3 hours ago Created xenodochial_heyrovsky
9d7d8bcb2226 d73c44a6c215 "/bin/sh -c '#(nop..." 3 hours ago Created sleepy_noyce
36012d4c6115 d73c44a6c215 "/bin/sh -c '#(nop..." 3 hours ago Created adoring_hypatia
deacab89f416 d73c44a6c215 "/bin/sh -c '#(nop..." 3 hours ago Created objective_franklin
43e894f8fb9c d73c44a6c215 "/bin/sh -c '#(nop..." 3 hours ago Created sleepy_hodgkin
2d190d0fc6e5 d73c44a6c215 "/bin/sh -c '#(nop..." 3 hours ago Created modest_hoover
b1640a039c31 d73c44a6c215 "/bin/sh -c '#(nop..." 3 hours ago Created affectionate_galileo
baf94cf2dc6e d73c44a6c215 "/bin/sh -c '#(nop..." 3 hours ago Created affectionate_elion
2b54996907b6 d73c44a6c215 "/bin/sh -c '#(nop..." 3 hours ago Created elastic_wiles
663d4e096938 8f5126108354 "/bin/sh -c 'pip i..." 15 hours ago Exited (1) 15 hours ago admiring_agnesi
您的问题是如何调用UWSGI。您传递app.py
的方式告诉uwsgi它是一个配置文件,而不是python可调用的文件。
我更喜欢使用ini文件来配置uwsgi,因为这比向DockerFile添加一堆命令行选项更干净。如果您面临问题,请参阅相关文档了解如何部署flask和uwsgi。
UWSGI:快速启动烧瓶
uwsgi.ini:
[uwsgi]
socket = 0.0.0.0:8000
chdir = /webapp/
wsgi-file = app.py
callable = app
...
DockerFile:
...
# no ENTRYPOINT, use only CMD
CMD ["uwsgi", "/webapp/uwsgi.ini"]
避免同时使用ENTRYPOINT和CMD,直到您完全理解它们是如何交互的。如果有疑问,只需使用cmd即可。
问题内容: 我尝试在构建映像的同时使用Docker安装软件,然后得到了。 我使用的Dockerfile 有没有一种方法可以在Dockerfile中运行docker命令来创建映像? 问题答案: 您的问题不在于Docker命令,因为它在错误消息中表示您的Docker守护程序未运行,或者由于某些配置问题而无法连接到它。 您刚刚安装了Docker吗?您是否完成了《安装指南》中的所有步骤? 您可以使用或来测
我正在尝试在我的笔记本电脑上创建一个swarm设置。我正在笔记本电脑上运行swarm守护进程,并作为docker节点运行2个Ubuntu14.04VM。在其中一个节点上,我可以运行swarm,并且可以连接到swarm守护进程。我可以用docker信息列出节点,并在其上生成一个容器。但是当我尝试在另一个VM节点上拉swarm映像时,我得到以下错误: 更新:这是一个不同的东西。我是在家里试的。今天早上
我在从控制器加载javaFX中的图像时遇到了一些麻烦。 我把一些图像放在src/文件夹中,甚至放在img/文件夹中,但仍然得到“无效URL或未找到资源”。 但我无法检索图像“java.lang.IllegalArgumentException:无效URL或未找到资源” 谢谢你的帮助
问题内容: 我已经尝试过将docker和jenkins一起使用,两者都安装在我的机器上(w10),并且我使用jankins运行docker镜像。但是,当我按照jenkins文档中的示例(来自doc的示例)时,它不起作用。不涉及时,不同的管道脚本可以工作,我还尝试从jenkins config接口添加。 管道脚本 错误堆栈 我在SO上发现了类似的问题\(相同但没有明确的解决方案) 问题答案: 您的工
我尝试以配置yaml文件作为参数运行opentelemetry docker映像:
我对spring boot非常陌生,并且正在学习Guru spring framework教程。 我的简单的Spring Boot应用程序运行成功,我的控制器工作良好。我使用了thymeleaf来显示html页面,并使用了一些引导CS,所有的工作都很好,只是在我的一个html页面中有一个图像标签。当我运行应用程序时,Tymeleaf显示了正确的页面,但图像没有显示。我搜索了一下,并将我的图像放在/