1

I am using:

  1. Ubuntu 16.04.
  2. Docker version 1.12.6.

I want to containerize my existing Django app., knowing that everything goes well in this app. => no bugs, no errors...

My Dockerfile:

FROM django

ADD . /BackendServer

WORKDIR /BackendServer

RUN pip install -r requirements.txt

CMD [ "python", "BackendServer/manage.py runserver 0.0.0.0:8000" ]

requirements.txt

djangorestframework
gunicorn

Now everything goes well, except the last line when executing the manage.py python, it says: "python: can't open file 'BackendServer/manage.py runserver 0.0.0.0:8000': [Errno 2] No such file or directory".

So, I execute the following command: "sudo docker run backendserver ./BackendServer/manage.py runserver 0.0.0.0:8000"

I got no errors and still the server is not running!! errors screen

What shall I do so that I can access the django server !? Please help!!

Additional note: here is the execution of "ls BackendServer" in the container.

thanks in advance!

1 Answer 1

2

You have already changed the directory into /BackendServer.

Use this instead:

CMD [ "python", "./manage.py runserver 0.0.0.0:8000" ]

Also note that docker run executes without a tty by default, which will suppress the output. Run with -it to use interactive terminal.

Sign up to request clarification or add additional context in comments.

3 Comments

I used it " CMD [ "python", "./manage.py runserver 0.0.0.0:8000" ]", but I got the same error "python: can't open file 'BackendServer/manage.py runserver 0.0.0.0:8000': [Errno 2] No such file or directory".
You are right, after running it with -it I got some errors I will deal wih them :D, thanks ...
Please remember to rebuild the container after you change the Dockerfile.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.