I have a server-api app.
In my localhost, I just need 2 commands to launch the app:
- npm install
- npm start
No more, and it works perfect at the port 3000.
I'm trying to dockerize my server to launch it with docker-compose.
Ok, this is my dockerfile:
FROM node:14-alpine AS development
ENV NODE_ENV development
WORKDIR /app
COPY package.json .
COPY package-lock.json .
RUN npm install
COPY . .
EXPOSE 3000
CMD ["npm", "start"]
I launch the build command to build the image:
docker build --tag server-api .
And when it finish, I run the container:
docker run -p 80:3000 server-api
The logs is perfect, it says that is running in the port 3000 and that I should connect to localhost:3000 to review my server-api app.
But, I undestand that is the port of the container, I had launch the container with the command -p 80:3000, so I check the port 80 of my computer... but nothing happens.
What should be my troubleshooting?
I already tried to get some info connecting with my container:
docker exec -it <container_id> sh
But everythings looks perfect and is a simple app.
What Im doing wrong?