1

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.

Winston
  • 1,308
  • 5
  • 16
  • 34
  • The two most common causes of this are failing to publish a port with a `docker run -p` option, or setting your container to listen on the container-private 127.0.0.1 address. Can you [edit] the question to include a [mcve]; not just how you debugged it, but enough source code to see what's actually running in the container and how you started it? – David Maze Jul 06 '23 at 00:22
  • @DavidMaze Thanks for the reply. I edited the question to add the Dockerfile. Also I checked docker container port, I thought the port should be published. Not sure how could I check? Thanks – Winston Jul 06 '23 at 01:17
  • @DavidMaze I eventually find the problem is not on the docker side, but on the stable-diffusion-webui side – Winston Jul 06 '23 at 01:30

1 Answers1

2

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.

Winston
  • 1,308
  • 5
  • 16
  • 34