NestJS with Docker and Portainer

726 Views Asked by At

i'm trying to turn UP my project with a Virtual Private Server. I've installed Docker and Portainer and i can start the project. But its not running in any port. I did set to run in port 3000 but when i put in browser IP_Of_My_VPS:3000 nothing happens. I'm new with docker and every configuration that i did was based on my searchs.

This print shows that image is running in no one port.

This other print shows that my application is running (but i dont know how access it).

My docker config:

FROM node:12-alpine

RUN apk --no-cache add curl
RUN apk --no-cache add git
RUN git --version

WORKDIR /app

COPY package*.json ./

RUN npm set progress=false && npm config set depth 0 && npm cache clean --force

RUN npm ci

COPY . .

RUN npm run build && rm -rf src

HEALTHCHECK --interval=30s --timeout=3s --start-period=30s \
  CMD curl -f http://localhost:3000/health || exit 1

EXPOSE 3000

CMD ["node", "./dist/main.js"]
1

There are 1 best solutions below

4
On

When docker container up, perform port forwarding

for examples,

docker run -p <your_forwarding_port>:3000 ~~~
# docker-compose.yaml
~~~
     ports:
       - "<your_forwarding_port>:3000"
~~~

you can see ref
: docker-container port
: docker-compose port