Docker运行无法找到可执行文件"uwsgi". [英] Docker run cannot find executable "uwsgi"

查看:577
本文介绍了Docker运行无法找到可执行文件"uwsgi".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试与Docker一起部署falcon应用程序.这是我的Dockerfile:

I am trying to deploy a falcon app with Docker. Here is my Dockerfile:

FROM python:2-onbuild

# Set the working directory to /app
WORKDIR /app

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

RUN pip install -r ./requirements.txt
RUN pip install uwsgi

EXPOSE 8000

CMD ["uwsgi", "--http", " :8000" , "—wsgi-file", "falconapp.wsgi"]

但是我总是收到错误消息:

However I keep getting error saying:

/bin/sh: 1: [uwsgi,: not found

我已经尝试在本地目录中运行uwsgi,并且与以下命令配合使用效果很好:

I've tried running uwsgi in the local directory and it works well with the command:

uwsgi --http :8000 --wsgi-file falconapp.wsgi

在这种情况下,为什么Docker不起作用???

Why is Docker not working in this case???

这是日志,我很确定已安装uwsgi:

Here is the log, I'm pretty sure uwsgi is installed:

Step 5/7 : RUN pip install uwsgi
 ---> Running in 2df7c8e018a9
Collecting uwsgi
  Downloading uwsgi-2.0.17.tar.gz (798kB)
Building wheels for collected packages: uwsgi
  Running setup.py bdist_wheel for uwsgi: started
  Running setup.py bdist_wheel for uwsgi: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/94/c9/63/e7aef2e745bb1231490847ee3785e3d0b5f274e1f1653f89c5
Successfully built uwsgi
Installing collected packages: uwsgi
Successfully installed uwsgi-2.0.17
Removing intermediate container 2df7c8e018a9
 ---> cb71648306bd
Step 6/7 : EXPOSE 8000
 ---> Running in 40daaa0d5efa
Removing intermediate container 40daaa0d5efa
 ---> 39c75687a157
Step 7/7 : CMD ["uwsgi", "--http", " :8000" , "—wsgi-file", "falconapp.wsgi"]
 ---> Running in 67e6eb29f3e0
Removing intermediate container 67e6eb29f3e0
 ---> f33181adbcfa
Successfully built f33181adbcfa
Successfully tagged image_heatmap:latest
dan@D-MacBook-Pro:~/Documents/falconapp_api$ docker run -p 8000:80 small_runner
/bin/sh: 1: [uwsgi,: not found

推荐答案

很多时候,您必须为可执行文件编写完整的补丁程序.如果转到容器并运行此命令whereis uwsgi,它将告诉您它位于/usr/local/bin/uwsgi,因此您的CMD应该采用相同的格式:

very often you have to write the full patch for the executable. If you go to your container and run this command whereis uwsgi it will tell you it is at /usr/local/bin/uwsgi so your CMD should be in the same form:

CMD ["/usr/local/bin/uwsgi", "--http", " :8000" , "--wsgi-file", "falconapp.wsgi"]

这篇关于Docker运行无法找到可执行文件"uwsgi".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆