Docker Community Forums

Share and learn in the Docker community.

Docker container running but not accessible in the browser

Hi,

I have a container running but I can’t access my API in the browser. This is the content of my dockerfile

FROM python:3.8.1

ENV PYTHONUNBUFFERED 1

EXPOSE 8000

WORKDIR /app

COPY poetry.lock pyproject.toml ./

RUN pip install poetry==1.0.* && \

    poetry config virtualenvs.create false && \

    poetry install --no-dev

COPY . ./

#CMD uvicorn --host=0.0.0.0 app.main:app --reload

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

and I built it using
docker build -t rule-engine-api .

run the container using
docker run -d --name sample-api -p 8000:800 rule-engine-api

But I cannot seem to access it in my browser. Any help would be appreciated.