Skip to content
Advertisement

Docker run does not produce any endpoint

I am trying to dockerize this repo. After building it like so:

JavaScript

I try to run it like so:

JavaScript

It downloads the necessary libraries and packages:

enter image description here

And then nothing… No errors, no endpoints generated, just radio silence.

What’s wrong? And how do I fix it?

Advertisement

Answer

You appear to be expecting your application to offer a service on port 5000, but it doesn’t appear as if that’s how your code behaves.

Looking at your code, you seem to be launching a service using gradio. According the quickstart, calling gr.Interface(...).launch() will launch a service on localhost:7860, and indeed, if you inspect a container booted from your image, we see:

JavaScript

There’s no way to access a service listening on localhost from outside the container, so we need to figure out how to fix that.

Looking at these docs, it looks like you can control the listen address using the server_name parameter:

server_name

to make app accessible on local network, set this to “0.0.0.0”. Can be set by environment variable GRADIO_SERVER_NAME. If None, will use “127.0.0.1”.

So if we run your image like this:

JavaScript

Then we should be able to access the interface on the host at http://localhost:7860/…and indeed, that seems to work:

enter image description here


Unrelated to your question:

  • You’re setting up a virtual environment in your Dockerfile, but you’re not using it, primarily because of a typo here:

    JavaScript

    You’re missing a $ on $VIRTUAL_ENV.

  • You could optimize the order of operations in your Dockerfile. Right now, making a simple change to your Dockerfile (e.g, editing the CMD setting) will cause much of your image to be rebuilt. You could avoid that by restructuring the Dockerfile like this:

    JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement