Skip to content

Instantly share code, notes, and snippets.

@calbertts
Last active February 24, 2017 14:44
Show Gist options
  • Save calbertts/0c8e9652a38e8a0135a98d163c08ed70 to your computer and use it in GitHub Desktop.
Save calbertts/0c8e9652a38e8a0135a98d163c08ed70 to your computer and use it in GitHub Desktop.
Starts a stopped docker container
startc() {
export FZF_DEFAULT_OPTS='--height 90% --reverse --border'
local container=$((docker ps -a --filter status=exited --format '{{.Names}} => {{.Image}} => EXITED' & docker ps -a --filter status=created --format '{{.Names}} => {{.Image}} => CREATED') | fzf-tmux --reverse --multi | awk -F '\\=>' '{print $1}')
if [[ $container != '' ]]; then
echo -e "\n \033[1mDocker container:\033[0m" $container
echo -e "\n Starting $container ...\n"
history -s startc
history -s docker start $container
docker start $container > /dev/null
fi
export FZF_DEFAULT_OPTS=""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment