Answer the question
In order to leave comments, you need to log in
How to forward a port from a Docker container with a Django application to Nginx installed on localhost?
I use docker compose for deployment. Part of the yml file looks like this:
web:
build: .
volumes:
- ./app_data:/app/media/favicon
- ./static:/app/static
ports:
- 8000:8000
restart: unless-stopped
depends_on:
- db
expose:
- 8000
Answer the question
In order to leave comments, you need to log in
Normal approach: prescribe forwarding specifically on the loopback interface: ports:[127.3.2.1:8000:8000]
Based on thick hints, you want only nginx to have access to the port, for this you need to authorize it - through a firewall with an application definition or a proxy with authorization within the container network.
expose
in the container information indicates that such and such ports are used, no action is taken.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question