OSError: Cannot find empty port in range: 7861-7960. You can specify a different port by setting the GRADIO_SERVER_PORT environment variable or passing the server_port parameter to launch()
not a suitable workaround:
import gradio as gr
import logging
logging.basicConfig(level=logging.DEBUG)
def greet(name, intensity):
return "Hello, " + name + "!" * int(intensity)
demo = gr.Interface(
fn=greet,
inputs=["text", "slider"],
outputs=["text"],
)
if __name__ == "__main__":
demo.launch(debug=True, server_name="[::]")
because the docker container is not reachable from [::]:7861 from the host system. I verified it with a fastapi sample and the fastapi works dualstack no problem (access via [::1]:8080 in the browser).
Another interesting obversation is, the when GRADIO_SERVER_NAME=0.0.0.0 is set as a container environment variable, i am able to access it via http://[::1]:7860/ from my host system's browser ( keep an eye on my port mapping configuration in the docker compose)
My suggestion is to seperate IPv4 from IPv6. When you choose 0.0.0.0 it will only listen to IPv4 and if you choose :: it will listen to IPv4+IPv6.
Have you searched existing issues? 🔎
[X] I have searched and found no existing issues
Reproduction
import gradio as gr
import logging
logging.basicConfig(level=logging.DEBUG)
def greet(name, intensity):
return "Hello, " + name + "!" * int(intensity)
demo = gr.Interface(
fn=greet,
inputs=["text", "slider"],
outputs=["text"],
)
if __name__ == "__main__":
demo.launch(debug=True)
Describe the bug
Trying to set a dualstack network configuration via environment variables in docker compose
fails with:
OSError: Cannot find empty port in range: 7861-7960. You can specify a different port by setting the GRADIO_SERVER_PORT environment variable or passing the
server_port
parameter tolaunch()
not a suitable workaround:
because the docker container is not reachable from [::]:7861 from the host system. I verified it with a fastapi sample and the fastapi works dualstack no problem (access via [::1]:8080 in the browser).
Another interesting obversation is, the when GRADIO_SERVER_NAME=0.0.0.0 is set as a container environment variable, i am able to access it via http://[::1]:7860/ from my host system's browser ( keep an eye on my port mapping configuration in the docker compose)
My suggestion is to seperate IPv4 from IPv6. When you choose 0.0.0.0 it will only listen to IPv4 and if you choose :: it will listen to IPv4+IPv6.
Have you searched existing issues? 🔎
Reproduction
Screenshot
No response
Logs
System Info
Severity
I can work around it