I'm trying to do a copy of my django image
that I found here:
https://hub.docker.com/r/library/django
Well, at this point the image is working good, but I'm trying to generate a container from this one.
Well using the commands:
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3c3e94ff32e7 django:latest "python3" 18 hours ago Exited (137) 17 hours ago django
$ docker images -a
REPOSITORY TAG IMAGE ID CREATED SIZE
django latest eb40dcf64078 9 months ago 436MB
Using:
$ docker commit django fmf
$ docker run -p 8000:8000 -td fmf /bin/bash
Now, I have the container fmf
and I generated a new django project using:
# django-admin startproject test
# python manage.py runserver 8000
But, this port is not open (or at least I can't see any response there). I'm not sure if the port is not open and using a bridge, but I get no reponse from this container.
What I'm doing wrong?
Finally, I found a solution in this thread: https://github.com/docker/for-win/issues/197
Basically, to run the server you should execute it with:
python manage.py runserver 0.0.0.0:8000
in your docker and in your local machine you can see it with:
localhost:8000
Try to put this on your Dockerfile:
EXPOSE 8000
Or maybe, you could try to see what is going on in your docker. Run this command to open a bash of your docker:
docker exec -it django /bin/bash
And then, see if there is any running process on port 8000.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With