R
RunPod5mo ago
gQsoQa

Container logs disappear after stopping the container

I have this script (src/test.sh):
echo "Working ..."
sleep 10
runpodctl stop pod "$RUNPOD_POD_ID"
echo "Working ..."
sleep 10
runpodctl stop pod "$RUNPOD_POD_ID"
And this Dockerfile:
FROM ubuntu:22.04
WORKDIR /app
COPY src src
ENTRYPOINT /app/src/test.sh
FROM ubuntu:22.04
WORKDIR /app
COPY src src
ENTRYPOINT /app/src/test.sh
When I run the container in RunPod (via the GraphQL endpoint using runpod-python) Working ... is printed out to the Container logs window as expected. However, after the 10 seconds when the container is killed the log disappear and is replaced with No Container logs yet, this usually means that the pod is still initializing. Both states are shown in screenshots. Can someone please help me with accessing the logs even after the container is stopped?
No description
No description
Solution:
we do not store logs once you stop the pod, they're only meant to be there for the life of running pod, you can push your logs to another service if needed, we may plan to have a central logging place for this in future
Jump to solution
6 Replies
Solution
flash-singh
flash-singh5mo ago
we do not store logs once you stop the pod, they're only meant to be there for the life of running pod, you can push your logs to another service if needed, we may plan to have a central logging place for this in future
gQsoQa
gQsoQa5mo ago
How can I access the logs programmatically so that I can push them to another service like you recommend?
flash-singh
flash-singh5mo ago
you would stream the logs from your container directly to another service, you can find opensource libs that can do that for you
ashleyk
ashleyk5mo ago
This doesn't include docker system and docker container logs though does it?
flash-singh
flash-singh5mo ago
nope only container logs we plan to introduce logging services where we will stream the logs for you automatically, thats sometime later this year
gQsoQa
gQsoQa5mo ago
Thank you!