Docker:“未知指令:VIRTUALENV”(Docker: "Unknown instruction: VIRTUALENV')

编程入门 行业动态 更新时间:2024-10-24 09:29:58
Docker:“未知指令:VIRTUALENV”(Docker: "Unknown instruction: VIRTUALENV')

Dockerfile

FROM ubuntu:14.04.2 RUN apt-get -y update && apt-get upgrade -y RUN apt-get install python build-essential python-dev python-pip python-setuptools -y RUN apt-get install libxml2-dev libxslt1-dev python-dev -y RUN apt-get install libpq-dev postgresql-common postgresql-client -y RUN apt-get install openssl openssl-blacklist openssl-blacklist-extra -y RUN apt-get install nginx -y RUN pip install virtualenv uwsgi ADD canonicaliser_api ~ virtualenv ~/canonicaliser_api/venv source ~/canonicaliser_api/venv/bin/activate pip install -r ~/canonicaliser_api/requirements.txt RUN echo "daemon off;" >> /etc/nginx/nginx.conf EXPOSE 80 CMD service nginx start

构建错误:

... Successfully installed virtualenv uwsgi Cleaning up... ---> 0c141e23f725 Removing intermediate container d9fd3c20365d Step 8 : ADD canonicaliser_api ~ ---> 89b4fb40dba5 Removing intermediate container b0c1ad946fc4 Step 9 : VIRTUALENV Unknown instruction: VIRTUALENV

应该删除那些容器吗? 为什么不看到virtualenv ?

Dockerfile:

FROM ubuntu:14.04.2 RUN apt-get -y update && apt-get upgrade -y RUN apt-get install python build-essential python-dev python-pip python-setuptools -y RUN apt-get install libxml2-dev libxslt1-dev python-dev -y RUN apt-get install libpq-dev postgresql-common postgresql-client -y RUN apt-get install openssl openssl-blacklist openssl-blacklist-extra -y RUN apt-get install nginx -y RUN pip install virtualenv uwsgi ADD canonicaliser_api ~ virtualenv ~/canonicaliser_api/venv source ~/canonicaliser_api/venv/bin/activate pip install -r ~/canonicaliser_api/requirements.txt RUN echo "daemon off;" >> /etc/nginx/nginx.conf EXPOSE 80 CMD service nginx start

Build error:

... Successfully installed virtualenv uwsgi Cleaning up... ---> 0c141e23f725 Removing intermediate container d9fd3c20365d Step 8 : ADD canonicaliser_api ~ ---> 89b4fb40dba5 Removing intermediate container b0c1ad946fc4 Step 9 : VIRTUALENV Unknown instruction: VIRTUALENV

is it supposed to remove those containers? Why isn't it seeing virtualenv?

最满意答案

应该删除那些容器吗?

是。 如果由于某种原因想要保留它们, --rm=false传递给--rm=false docker build命令。

为什么不看到virtualenv ?

它正在看到它,但因为它在一行的开头,它将它视为Dockerfile指令,但没有“VIRTUALENV”指令。 据推测,您打算在ADD之后的每一行之前放置RUN :

ADD canonicaliser_api ~ RUN virtualenv ~/canonicaliser_api/venv # This one needs to be a single RUN so the "source" will affect pip. RUN source ~/canonicaliser_api/venv/bin/activate && \ pip install -r ~/canonicaliser_api/requirements.txt

is it supposed to remove those containers?

Yes. If you want to keep them for some reason, pass --rm=false to the docker build command.

Why isn't it seeing virtualenv?

It is seeing it, but because it's at the start of a line, it treats it like a Dockerfile instruction, but there is no "VIRTUALENV" instruction. Presumably, you meant to put RUN before each line after the ADD:

ADD canonicaliser_api ~ RUN virtualenv ~/canonicaliser_api/venv # This one needs to be a single RUN so the "source" will affect pip. RUN source ~/canonicaliser_api/venv/bin/activate && \ pip install -r ~/canonicaliser_api/requirements.txt

更多推荐

本文发布于:2023-07-31 02:37:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1340462.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:指令   Docker   VIRTUALENV   instruction   Unknown

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!