4 ms·
> But what if the person who started the container didn't use docker-compose? There's your shell history, combined with fzf this helps recall previously run co
by nickjj 4y ago
> But what if the person who started the container didn't use docker-compose?
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.
- deleted 4y ago[deleted]
- radpanda 4y agoI hear ya. I've also been using Docker for years and have encountered this scenario: Now-retired Cowboy Coder "got things working" using vanilla "docker run" commands before he departed but didn't document it or script it, now I need to figure out what he did to firstly understand it, and secondly extend it. I don't have his bash history, I just have the running container. I get it if you can't conceive of a use for this but apparently at least a couple of us think it could occasionally be useful.
- j33zusjuice 4y agoI’ve run into this several times in my current role. The people who came before me fucked up command history really badly (they were trying to have per-user, per-connection logging, and didn’t know how to do that properly), so a good deal of commands used to spawn containers have been lost over here. I agree you should never be in this situation (this place is an absolute nightmare), but here I am!
- jmholla 4y agoDo you have any good resources on how to manage this? I've run into similar history management problems with `screen`.
- j33zusjuice 4y agoFor bash, and maybe zsh, I use this in a profile.d script to log history output. 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_COMMAND I 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.
- v3ss0n 4y agoresh is my favorite
- v3ss0n 4y agoresh is my favorite https://github.com/curusarn/resh https://github.com/curusarn/resh