I am trying to deploy an API with docker-compose. I am using FastAPI and I keep getting this error when I try to access the localhost page. If I don't use the docker-compose it works flawless. All my files are in the same directory.
Here is the Dockerfile
FROM python:3.9-slim
WORKDIR /usr/app
RUN python -m pip install --upgrade pip
COPY ./ ./
RUN pip install --no-cache-dir --upgrade -r requirements.txt
EXPOSE 8000
CMD [ "uvicorn", "main:app", "--reload" ]
And here is the docker-compose.yml
version: '2.2'
services:
api:
build: ./
volumes:
- './requirements.txt:/app'
And this is the error message I get on the browser:
ERR_CONNECTION_REFUSED