![](/img/trans.png)
[英]OCI runtime create failed: container_linux.go:349: starting container process caused “exec: \”xxxx\“: executable file not found in $PATH”: unknown
[英]cannot create /etc/nginx/nginx.conf: Directory nonexistent and starting container caused “exec: \”supervisord\“: executable file not found in $PATH”
我正在構建 docker 鏡像以使用 uwsgi/nginx 部署 Flask 應用程序。
這里有相關文件用於創建相同的 docker 容器
Dockerfile
內容
FROM python:3.6
MAINTAINER Dockerfiles
RUN mkdir /trell-ds-framework
WORKDIR /trell-ds-framework
ADD . /trell-ds-framework/
RUN python setup.py bdist_wheel
# install uwsgi now because it takes a little while
RUN pip3 install uwsgi
# copy over our requirements.txt file
# upgrade pip and install required python packages
RUN pip3 --no-cache-dir install -U pip
RUN apt-get install -y ca-certificates
RUN apt-get update && apt-get -y install cron
RUN pip3 --no-cache-dir install -r requirements.txt
RUN python -c "import nltk;nltk.download('stopwords')"
# setup all the configfiles
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
COPY nginx_app.conf /etc/nginx/sites-available/default
COPY supervisor_app.conf /etc/supervisor/conf.d/
# add (the rest of) our code
EXPOSE 80
CMD ["supervisord"]
supervisor_app.conf
內容
[supervisord]
nodaemon=true
[program:uwsgi]
command = /usr/local/bin/uwsgi --ini /trell-ds-framework/uwsgi.ini
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:nginx]
command = /usr/sbin/nginx
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
nginx_app.conf
內容
server {
listen 80 default_server;
server_name ip_address;
# max upload size
client_max_body_size 75M; # adjust to taste
location / {
include uwsgi_params;
uwsgi_pass unix:///trell-ds-framework/app.sock;
}
}
uwsgi.ini
文件內容
[uwsgi]
callable = app
chdir = /trell-ds-framework
wsgi-file = /trell-ds-framework/wsgi.py
socket = /trell-ds-framework/app.sock
master = true
processes = 2
chmod-socket = 666
enable-threads = true
當我嘗試在 trell-ds-framework 目錄中docker build -t ds_backend .
(使用命令docker build -t ds_backend .
,我在 Dockerfile 的第 13/17 行收到以下錯誤
Step 13/17 : RUN echo "daemon off;" >> /etc/nginx/nginx.conf
---> Running in 1ee5628a4bc2
/bin/sh: 1: cannot create /etc/nginx/nginx.conf: Directory nonexistent
The command '/bin/sh -c echo "daemon off;" >> /etc/nginx/nginx.conf' returned a non-zero code: 2
我檢查了這個/etc/nginx/nginx.conf
文件存在於我的虛擬機中。
我正在從這個教程中獲得幫助- 使用 docker 部署帶有 uwsgi/nginx 的燒瓶應用程序,這似乎正在工作。 但在我的情況下,它給出了那個錯誤。
按照評論說明后,我可以成功構建 docker 鏡像。 現在我在下面收到此錯誤。
docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"supervisord\": executable file not found in $PATH": unknown.
任何人都可以在這里幫助我。 提前致謝。
PS:我對這些東西很陌生。 任何線索高度贊賞。
由於管理帶有評論的答案幾乎是不可能的,我將在這里發布supervisor_app.conf
文件的前景:
[program:nginx]
command = /usr/sbin/nginx -g "daemon off;"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
我認為這就是你所需要的。
編輯:我剛剛看到有關找不到主管的評論。 看來你還沒有在Dockerfile中安裝它。 添加方法如下:
apt-get install -y supervisor
您可以在其中一個步驟中只添加包名稱,如下所示:
RUN apt-get install -y ca-certificates supervisor
請注意,您已經有了該行,只是沒有supervisor
。
EDIT2:根據@thsutton 的回答,您還需要添加nginx
包,就像您為supervisor
所做的一樣。
python:3.6
圖像是否已經包含nginx
和supervisord
? 如果沒有, apt-get
您來安裝它們(使用apt-get
或類似的命令,視情況而定)。
nginx 配置文件不存在且二進制文件不存在的事實向我暗示可能未安裝軟件包。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.