Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

144
Views
Docker container is starting but isnt giving any response using FastApi

I just made a Fast api and deployed it using docker containers. But when running 127.0.0.1:5000 on browser it has empty response. Main.py file:

from fastapi import FastAPI
from starlette.status import HTTP_302_FOUND,HTTP_303_SEE_OTHER
import spacy
from string import punctuation
from mangum import Mangum

nlp = spacy.load("en_core_web_lg",disable=["tok2vec", "parser"])

app = FastAPI()

@app.get('/')
def home():
    return {"answer":"Hello World"}

@app.get('/tags')
def prep_data(text):
    tag = tokens(text, nlp)
    tags = getdict(tag)
    return {
        'tags':tags
    }

Docker file:

FROM tiangolo/uvicorn-gunicorn-fastapi:python3.8

COPY . /app

COPY ./requirements.txt /app/requirements.txt

WORKDIR /app

EXPOSE 5000

RUN pip install -r requirements.txt
RUN python -m spacy download en_core_web_lg

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5000"]

File structure I am following:

/app
    main.py
Dockerfile
requirements.txt

These are all the contents and I am getting no response from the browser.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You should also link the exposed port to an open port on the host machine when running the container.

docker run -dp <host_port>:<container_port> <image>
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!