Home > Software engineering >  Docker run does not produce any endpoint
Docker run does not produce any endpoint

Time:10-15

I am trying to dockerize enter image description here

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

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

CodePudding user response:

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 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:

    ENV PATH="VIRTUAL_ENV/bin:$PATH"
    

    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:

    FROM python:3.9
    
    # Install dependencies
    RUN apt-get update && apt-get install -y tesseract-ocr
    
    RUN pip install virtualenv && virtualenv venv -p python3
    ENV VIRTUAL_ENV=/venv
    ENV PATH="$VIRTUAL_ENV/bin:$PATH"
    
    WORKDIR /app
    COPY requirements.txt ./
    RUN pip install -r requirements.txt
    
    RUN git clone https://github.com/facebookresearch/detectron2.git
    RUN python -m pip install -e detectron2
    
    COPY . /app
    
    # Run the application:
    CMD ["python", "-u", "app.py"]
    
  • Related