Docker shows blank local container, console shows “Failed to load resource: the server responded with a status of 404”

随声附和 提交于 2021-01-29 14:13:39

问题


I am trying to run a Docker container locally, via the command:

docker run --rm -d mellon:latest

The gunicorn command which is executing is:

gunicorn -b 0.0.0.0:8000 mellon.wsgi

(more specifically in the Dockerfile):

...

EXPOSE 8000

CMD python3 manage.py makemigrations && \
    python3 manage.py migrate && \
    gunicorn -b 0.0.0.0:8000 mellon.wsgi

Everything in the terminal seems fine, this is the end of what I see:

...
[2020-07-28 14:52:33 +0000] [10] [INFO] Starting gunicorn 20.0.4
[2020-07-28 14:52:33 +0000] [10] [INFO] Listening at: http://0.0.0.0:8000 (10)
[2020-07-28 14:52:33 +0000] [10] [INFO] Using worker: sync
[2020-07-28 14:52:33 +0000] [12] [INFO] Booting worker with pid: 12

So I then go to http://localhost:8000/ yet I just see a completely blank screen with the title and favicon of the project in the tab (see below).

This isn't an issue with caching, as I have tried it in a few browsers and the favicon and title appear there too. And upon using 'inspect element' on the page, it shows the contents of the index.html file of my Vue.js project there (located in mellon/frontend/dist). It isn't a problem with my project as running the front-end server (npm run serve) and the back-end server (python3 manage.py runserver) as I usually do shows everything to be fine on localhost:8080.

What could possibly be causing this issue?

Edit: After checking the console in Google Chrome, I see these errors:

I am unsure of how to solve these issues.


回答1:


I had a weird way of solving this. If you look at my screenshot of the console in Google Chrome, there is just a bunch of 'chunk' files. I did a fresh pull from my Git repository (where the .gitignore ignored all of these kind of files) and everything worked perfectly fine.



来源:https://stackoverflow.com/questions/63137306/docker-shows-blank-local-container-console-shows-failed-to-load-resource-the

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!