I'm building a new Docker image based on the standard Ubuntu 14.04 image.
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
But if I open a shell when running the image, running python
opens the interactive prompt as expected.
Why can't I invoke python
through CMD
in the Dockerfile?
–
I had the same error. But in my case it was syntax error in command.
Had CMD ["python" "app.py"]
instead of CMD ["python", "app.py"]
Validating the yaml file format can help in this case. Can use any online yaml validator.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
site design / logo © 2019 Stack Exchange Inc; user contributions licensed under cc by-sa 4.0
with attribution required.
rev 2019.11.22.35464