There's your shell history, combined with fzf this helps recall previously run commands. You can search for something like "docker redis" and find it in a few key strokes.
If the container got spawned by something else then I think that's reaching for "beyond-the-edge" edge cases. I've been using Docker since 2014 and worked with dozens of companies (contract work) related to using Docker and this scenario has happened 0 times where I wanted to be able to replicate the flags used to spawn a container but couldn't find the command. Nearly every container is spawned from using Docker Compose or it exists in your shell's history.
I agree you should never be in this situation (this place is an absolute nightmare), but here I am!
I've run into similar history management problems with `screen`.
HISTTIMEFORMAT=“%F %T $(logname) $(pwd) “
if [ ! -d $HOME/.history ]
then mkdir -p $HOME/.history
fi
PROMPT_COMMAND=‘echo “$(history 1)” >> $HOME/.history/$(date “+%F”)
fi
export PROMPT_COMMANDI suppose adding `readonly PROMPT_COMMAND` would be a good idea so no one overwrites it, but most people wouldn’t even think to look for it.
I don’t think this would do much for handling screen history, though.