So I'm trying to run Django developing server on a container but I can't access it through my browser. I have 2 containers using the same docker network, one with postgress and the other is Django. I manage to ping both containers and successfully connect 2 of them together and run ./manage.py runserver
ok but can't curl
or open it in a browser
Here is my Django docker file
FROM alpine:latest COPY ./requirements.txt . ADD ./parking/ /parking RUN apk add --no-cache --virtual .build-deps python3-dev gcc py3-pip postgresql-dev py3-virtualenv musl-dev libc-dev linux-headers RUN virtualenv /.env RUN /.env/bin/pip install -r /requirements.txt WORKDIR /parking EXPOSE 8000 5432
The postgres container I pulled it from docker hub
I ran django with
docker run --name=django --network=app -p 127.4.3.1:6969:8000 -it dev/django:1.0
I ran postgres with
docker run --name=some-postgres --network=app -p 127.2.2.2:6969:5432 -e POSTGRES_PASSWORD=123 -e POSTGRES_DB=parking postgres
Any help would be great. Thank you
https://stackoverflow.com/questions/65433038/running-django-developing-server-in-a-docker-container December 24, 2020 at 09:49AM
没有评论:
发表评论