Last active
February 24, 2017 14:44
-
-
Save calbertts/0c8e9652a38e8a0135a98d163c08ed70 to your computer and use it in GitHub Desktop.
Starts a stopped docker container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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