Reputation: 19312
I have created a very simple image that performs an one-off job (prints some dummy logs) and exits as follows:
➣ $ cat Dockerfile
from alpine:latest
COPY entrypoint.sh /usr/local/bin/entrypoint
ENTRYPOINT ["entrypoint"]
CMD ["100"]
...where
➣ $ cat entrypoint.sh
#!/bin/sh
ITERATIONS=${1:-1000}
counter=1
while [ "$counter" -le "$ITERATIONS" ]; do
echo "Executing and logging iteration no $counter"
counter=$(($counter + 1))
done
When trying to deploy to Cloud Run,
using the following command:
gcloud beta run deploy logger --image=pkaramol/logging --cluster=pkaramol-cloudrun
it fails with the following message that I cannot decode:
Service name (logging): logger Deploying container to Cloud Run on GKE service [logger] in namespace [default] of cluster [pkaramol-cloudrun] X Deploying new service... Configuration "logger" does not have any ready Rev ision. - Creating Revision... X Routing traffic... Configuration "logger" does not have any ready Revisio n. Deployment failed ERROR: (gcloud.beta.run.deploy) Configuration "logger" does not have any ready Revision.
... on some other occasions, it takes forever
Deploying container to Cloud Run on GKE service [mylogger] in namespace [default] of cluster [pkaramol-cloudrun]
⠶ Deploying new service... Configuration "mylogger" is waiting for a Revision
to become ready.
⠶ Creating Revision...
. Routing traffic...
Any suggestions?
Upvotes: 2
Views: 1022
Reputation: 3840
GCP released Cloud Run jobs back in 2022, this is probably what you need
Upvotes: 0
Reputation: 81336
When your container starts, it must launch a program that responds as an HTTP server on port $PORT (8080).
You can run just about any software in a container. The interface is HTTP Request/Response. The CPU is idled in between HTTP requests.
Your container does not follow the Cloud Run requirements and is terminated when Cloud Run detects no response / incorrect response on port $PORT.
Read this document to better understand the software requirements:
Upvotes: 3