I am facing the issue
(gcloud.run.deploy) Cloud Run error: Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable. Logs for this revision might contain more information.
There are a few post with this error but I couldn't find my particular case.
I am running a background task, nothing to expose, it connects to firebase process some data and store it back. I wanted this process to run on a container on Cloud Run so I made it a container, which runs perfectly locally, but when uploading it to CR it fails with the above error.
I tried to expose 8080 on dockerfile and a few more things but if you try to connect to they container it has no server running to connect to. It is a batch task.
Can anyone tell me if it is possible at all to upload this type of tasks to Cloud Run, I do not know how to solve the issue. I wouldnt believe google requires a server running on the container to allow it, I saw some posts with dev pulling an nginx on the image so they can expose the port but this would be totally unnecessary in my case.
Thanks for your advice
UPDATE
- Cloud Logging: The error simply say there was a fail to start the container, which is funny because the container starts and also shows some logs like if it were working but then it stops.
- Build on MAC yes.
- DockerFile is pretty simple.
FROM openjdk:11 ENV NOTIFIER_HOME /opt/app/ ENV NOTIFIER_LOGS /opt/notifications/logs/ RUN mkdir -p $NOTIFIER_HOME RUN mkdir -p $NOTIFIER_LOGS RUN apt update #RUN apt install curl COPY docker/* $NOTIFIER_HOME EXPOSE 8080 ENV TMP_OPTS -Djava.io.tmpdir=/tmp ENV LOG4j_OPTS -Dlog4j.configurationFile=$NOTIFIER_HOME/logback.xml ENV NOTIFIER_OPTS $TMP_OPTS $LOG4j_OPTS ENV JAVA_GC_OPTS -Xms1g -Xmx1g WORKDIR $NOTIFIER_HOME ENTRYPOINT ["sh", "-c", "/opt/app/entrypoint.sh"]