Skip to content

Instantly share code, notes, and snippets.

@cloud8421
Last active September 9, 2015 12:38

Revisions

  1. cloud8421 revised this gist Sep 9, 2015. 1 changed file with 13 additions and 3 deletions.
    16 changes: 13 additions & 3 deletions docker-helpers.bash
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,16 @@
    dshell() {
    local containers
    findcontainer() {
    local containers container
    containers=$(docker-compose ps | tail -n +3 | awk '{print $1}') &&
    container=$(echo "$containers" | fzf -x) &&
    docker exec -it $container /bin/bash
    echo $container
    }

    dshell() {
    local result=$(findcontainer)
    docker exec -it $result /bin/bash
    }

    dlog() {
    local result=$(findcontainer)
    docker logs -f $result
    }
  2. cloud8421 created this gist Sep 9, 2015.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    This assumes a working copy of <https://github.com/junegunn/fzf> in your `PATH`
    6 changes: 6 additions & 0 deletions docker-helpers.bash
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    dshell() {
    local containers
    containers=$(docker-compose ps | tail -n +3 | awk '{print $1}') &&
    container=$(echo "$containers" | fzf -x) &&
    docker exec -it $container /bin/bash
    }