How to access prior application logs from a dangling image?

So I know how I can access the logs for a running container (e.g. sudo docker logs APPNAME), but I’ve never tried before for a dangling image.

I have a node.js application running on Docker, and I need to check the logs from several different prior images to see if I can find instances of a glitch that occurred last week.

I can view the images in question by entering “docker images”, and that gives me the Image ID.

I can also inspect the image via: “docker image inspect IMAGE f2f928XXX

Is there any equivalent to sudo docker logs APPNAME whereby I can also include an IMAGE name? Or a way I can spin up an old image without affecting the production version in order to access the logs?

Appears that perhaps the logs aren’t actually stored in the image…

So if I don’t have any logging system setup, does that mean once I deploy an update, the logs for that container (previously) are erased?

The runtime logs of a container are not stored in an image.

For plain containers (docker run/docker compose): very much so.
Though container tasks created by swarm services have a job history (the terminated containers are simply kept), which allows to read their logs as long as they exist in the job history (if i am not mistaken)

Thanks - I’m checking out Logz.io to store these logs in the future.