Unabe to Connect to server

Hi.
I am using docker to dockerize my Django app.

Here is the container of Dockerfile:

# base image
FROM python:3.8
# setup environment variable
ENV DockerHOME=/home/app/webapp

# set work directory
RUN mkdir -p $DockerHOME

# where your code lives
WORKDIR $DockerHOME

# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# install dependencies
RUN pip install --upgrade pip

# copy whole project to your docker home directory.
COPY . $DockerHOME
# run this command to install all dependencies
RUN pip install -r requirements.txt
# port where the Django app runs
EXPOSE 8000
# start server
CMD python manage.py runserver

docker run docker-django-v0.0 starts the development server at : http://127.0.0.1:8000/, but on visiting the address, Firefox shows Unable to Connect.

Can somebody please help me with this to make the app running,

Hi

did you map the ports when you started the container? also you need to make sure that your server is listning on all interfaces, since 127.0.0.1 would be within the container

terpz mend to say “all interfaces”, as in bind to 0.0.0.0, instead of 127.0.0.1

damn autocorrect :joy: edited my post

1 Like

You can still edit it.