Docker图像错误:“/ bin / sh:1:[python,:not found”

编程入门 行业动态 更新时间:2024-10-27 02:24:08
本文介绍了Docker图像错误:“/ bin / sh:1:[python,:not found”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在基于标准的Ubuntu 14.04映像构建一个新的Docker映像。

I'm building a new Docker image based on the standard Ubuntu 14.04 image.

这是我的Dockerfile :

Here's my Dockerfile:

FROM ubuntu:14.04 RUN apt-get update -y RUN apt-get install -y nginx git python-setuptools python-dev RUN easy_install pip ADD . /code WORKDIR /code RUN pip install -r requirements.txt # only 'django' for now ENV projectname myproject EXPOSE 80 8000 WORKDIR ${projectname} CMD ['python', 'manage.py', 'runserver', '0.0.0.0:80']

当我尝试运行此图像时,我收到此错误...

When I try to run this image, I get this error...

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

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

但是,如果我在运行图像时打开shell,运行 python 按预期打开交互式提示。

But if I open a shell when running the image, running python opens the interactive prompt as expected.

为什么我无法通过 CMD 调用 python 在Docker文件中?

Why can't I invoke python through CMD in the Dockerfile?

推荐答案

使用而不是'在CMD。(文档)

Use " instead of ' in CMD. (Documentation)

更多推荐

Docker图像错误:“/ bin / sh:1:[python,:not found”

本文发布于:2023-11-14 16:41:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1587986.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图像   错误   Docker   python   sh

发布评论

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

>www.elefans.com

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