Closed jivaklong closed 4 weeks ago
I found some similar issues and discussions that might help you resolve the "502 Bad Gateway" error when launching the front-end Docker container separately:
I can't access localhost/install and get a 502 Bad Gateway after deploying the docker (closed):
docker-web-1
and docker-api-1
containers. Restart the Nginx container to apply the changes [1].Changes made to frontend not showing up when app run locally using Docker (closed):
entrypoint.sh
is in UNIX format, set the correct environment variables (CONSOLE_URL
and APP_URL
), and verify file permissions. Properly configure the Dockerfile to copy and set the entrypoint script [2].repack images but 502 bad gateway (closed):
entrypoint.sh
script if necessary [3].To resolve your specific issue, follow these steps:
Ensure Containers are Running:
docker ps -q | xargs -n 1 docker inspect --format '{{ .Name }}: {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'
Update Nginx Configuration:
docker-web-1
and docker-api-1
.dify/docker/nginx/conf.d
.http://api:5001
with http://<docker-api-1 IP>:5001
and http://web:3000
with http://<docker-web-1 IP>:3000
.Restart Nginx:
docker compose restart nginx
Run the Frontend Container:
docker run -it -p 3000:3000 -e CONSOLE_URL=http://127.0.0.1:5001 -e APP_URL=http://127.0.0.1:5001 dify-web
These steps should help you resolve the "502 Bad Gateway" error by ensuring Nginx forwards requests to the correct IP addresses of the running containers and by properly configuring the frontend service [1][2][3].
To continue talking to Dosu, mention @dosu.
Please attach the container logs as well. What did you changed?
This is done through Docker ps-a and Docker logs 7e8c81f35aec (viewing my-dify-web), where my-dify-web is a locally created image.
I think 502 Bad Gateway
is due to the server isn't started up properly.
Using docker images view:
Using Docker PS - a, check that my-dify-web Status is up and in the started state .
If I run the commands docker stop 7e8c81f35aec (stop my-dify-web), docker start e6bf2af75e45 (start langgenius/dify-web: 0.7.3), the webpage will pass through http://localhost:8070/ Can be opened normally. But I want to start the frontend Docker container separately
The above code only modifies a few places for testing, and then runs the command:docker build . -t dify-web docker run -d -p 3000:3000 -e CONSOLE_API_URL= http://127.0.0.1:5001/ -e APP_API_URL= http://127.0.0.1:5001/ dify-web
Self Checks
Provide a description of requested docs changes
Start the front-end Docker container separately cd web && docker build . -t dify-web docker run -it -p 3000:3000 -e CONSOLE_API_URL= http://127.0.0.1:5001 -e APP_API_URL= http://127.0.0.1:5001 dify-web
The deployment of Docker Compose on the server has been completed and can run normally. Stop the original DIY web container and run the command above. When opening the website, an error message appears below
502 Bad Gateway nginx/1.27.1