I'm trying to setup pythons django inside a dockerized environment
Dockerfile
FROM python:3.5-slim
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
RUN pip install --upgrade pip
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
ADD . /code/
EXPOSE 8000
I build this to django-app
.
docker-compose.yml
django:
container_name: django
image: django-app:latest
ports:
- "8000:8000"
volumes:
- ./config/startup.sh:/startup.sh
- ./app:/code
command: /bin/sh /startup.sh
startup.sh
#!/bin/sh
cd /code
django-admin.py startproject djagento
echo "Creating Project djagento"
cd djagento
python manage.py runserver
I am using ubuntu 14.04 LTS as my host system
docker exec -it django bash
$curl 127.0.0.1:8000
is succesfull.
I am getting the ip of my container with docker inspect django
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2"
But when trying to curl 172.17.0.1:8000
or curl 172.17.0.2:8000
or curl 127.0.0.1:8000
I am not able to get anything but connection reset
Edit
docker ps
baada462ae72 django-app:latest "/bin/sh /startup.sh" 6 seconds ago Up 5 seconds 0.0.0.0:8005->8000/tcp django
*ON another Port, same result *
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a9d99ee563e5 django-app:latest "/bin/sh /startup.sh" About a minute ago Up About a minute 0.0.0.0:8005->8000/tcp django
Thanks