Torchserve docker - not accessible outside

I have created a docker image for the torchserve model used for sentiment analysis. I am able to run the torchserve model and get right responses but after creating the docker image, when I send curl request, I get curl: (56) Recv failure: Connection reset by peer.

This is my Dockerfile

FROM pytorch/torchserve

#set the working directory

WORKDIR /app

COPY model_store app/model_store

COPY requirements.txt app/

RUN pip install -r app/requirements.txt

COPY start_torchserve.sh app/

EXPOSE 8080/tcp
EXPOSE 8080/udp
EXPOSE 8081/tcp
EXPOSE 8081/udp

CMD ["torchserve", "--start", "--model-store","app/model_store","--models", "FirstModel.mar"]

I ran the docker image with docker run -it -p 8080:8080 --gpus all torchserve.
I am able to receive responses inside the docker container but when I hit the api outside the container I get curl: (56) Recv failure: Connection reset by peer.