I built a docker image based on stable-diffusion-webui and after the container started I wouldn't be able to access the web server inside the docker.
I entered the docker image and make sure the server is working:
$ docker exec -it d29e04e6ca24 bash
---Inside Docker---
root@d29e04e6ca24:/sd# curl -sS -D - localhost:7860 -o /dev/null
HTTP/1.1 200 OK
date: Wed, 05 Jul 2023 23:49:47 GMT
server: uvicorn
content-length: 671907
content-type: text/html; charset=utf-8
However when I go back to the host machine then I failed to access the server:
$ docker container port d29e04e6ca24
7860/tcp -> 0.0.0.0:7860
7860/tcp -> [::]:7860
$ curl -sS -D - localhost:7860 -o /dev/null
curl: (56) Recv failure: Connection reset by peer
Here is the Dockerfile.
Not sure how should I tackle this problem. Thanks in advance.
Eventually find that stable-diffusion-webui was listening loopback interface only. And thus I wouldn't be able to access the server running inside the docker.
To accept traffic from all of the available interfaces I would need to add the argument --listen
would solve the problem. Here is the reference.