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

Google Cloud Run: Deploying container error, user-provided container failed to start and listen

Dockerfile:

 

 

FROM nginx:alpine

# Remove the default Nginx configuration
RUN rm /etc/nginx/conf.d/default.conf

# Copy the script or static files required for your application
COPY quickstart.sh /usr/share/nginx/html/

# Set the working directory
WORKDIR /usr/share/nginx/html/

# Expose the default Nginx port (optional)
EXPOSE 8080

# Start Nginx when the container starts
CMD ["nginx", "-g", "daemon off;"]

 

 

Cloud Shell command:

 

 

gcloud run deploy michael-testing-mk2 --source .

 

 

Output:

 

 

Revision 'michael-testing-mk2-00002-cus' is not ready and cannot serve traffic. The user-provided container failed to start and li
sten on the port defined provided by the PORT=8080 environment variable.

 

 

 

 

 

0 1 1,750
1 REPLY 1


@midacanay wrote:

# Expose the default Nginx port (optional) EXPOSE 8080


 

Try removing that and change cloud run port configuration from 8080 to 80 and re-deploy it should work. 

I hope that helps