Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Run a node js project with nginx through docker file

I had created a Dockerfile for node js project with nginx(without docker-compose.yml) Actually I have to run it on gcp, so, I don't need that file. I have to run the project through dockerfile only

```

FROM node:16 as nodework

WORKDIR /auto-notification

COPY package*.json ./

RUN npm install

COPY . .

#EXPOSE 8080

CMD ["npx","nodemon"]

#nginx block
FROM nginx:1.23-alpine
WORKDIR /user/nginx
RUN rm -rf ./*
COPY --from=nodework /auto-notification .
#EXPOSE 8080
ENTRYPOINT ["nginx", "-g", "daemon off;"]

```

When I am going to up it on gcp I am getting the error

```

ERROR: (gcloud.run.services.update) The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable. Logs for this revision might contain more information.
 
```

 

0 1 1,732
1 REPLY 1

Hi @palashsamanta,

According to this documentation, check if the container is listening for incoming HTTP requests on the port that is defined by Cloud Run. Also confirm if the ‘PORT’ environment variable value inside the Cloud Run container reflects the port to which requests are sent.

You can do this if you need to configure the container ports.

If all port configuration are consistent within the container and Cloud Run, it’s recommended to contact the Google Cloud Support since they have appropriate tools to investigate this further.

Thanks!