S
S
Sergey Shlensky2019-10-19 16:53:23
Docker
Sergey Shlensky, 2019-10-19 16:53:23

I can't connect to a Django project running through docker, what should I do?

Trying to curb Docker, tried running having a Django project

Dockerfile
FROM python:3.6

ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
COPY . /code/
RUN pip install --upgrade pip
RUN pip install -r requirements.txt

docker-compose.yml
version: '3'


services:
  web:
    build: .
    command: python app/manage.py runserver 0.0.0.0:8000
    volumes:
      - .:/code
    ports:
      - '8000:8000'

If you run through docker-compose up -dand check the flood docker-compose psit gives:
Name                         Command               State           Ports
--------------------------------------------------------------------------------------------
backendtopstudentsru_web_1   python app/manage.py runse ...   Up      0.0.0.0:8000->8000/tcp

but I can not connect to 0.0.0.0:8000 not to 127.0.0.1:8000 Tell me
how to solve this problem

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2019-10-19
@fox_12

Try like this:

version: '3'


services:
  web:
    build: .
    command: python app/manage.py runserver 0.0.0.0:8000
    volumes:
      - .:/code
    ports:
      - '0.0.0.0:8000:8000'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question