Replace container with roll-back possibility

I have a RPI 4 and run a HomeAssistant container on it.

I want to upgrade it to the latest version, so I need to stop and delete the container and download and run the latest image as new container.

I haven’t done this before and would like to be sure there is a way back if things don’t work properly.

How can I check which version of the image is running as container now and can I run it again if the latest version doesn’t work well?

Only swarm deployments keep a history of the containers.

But, once you modify data in a volume or in a remote system, the overall state could be tainted by changes performed by the new image version. It really depends on the application and what happens when the updated image is started.