Skip to content

Instantly share code, notes, and snippets.

@karellm
Created October 15, 2015 09:07

Revisions

  1. karellm created this gist Oct 15, 2015.
    37 changes: 37 additions & 0 deletions Docker aliases
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    # DOCKER
    # ======

    if hash docker 2>/dev/null; then
    alias dk="docker"
    fi

    dsa () {
    docker stop $(docker ps -a -q)
    }

    dra () {
    docker rm $(docker ps -a -q)
    }

    drmia () {
    docker rmi $(docker images | grep '^<none>' | awk '{print $3}')
    }

    dkme () {
    eval "$(docker-machine env default)"
    }

    if hash docker-machine 2>/dev/null; then
    alias dkm="docker-machine"
    alias dkmu="docker-machine start default"
    alias dkmd="docker-machine stop default"
    fi

    if hash docker-compose 2>/dev/null; then
    alias dkc="docker-compose"
    alias dkcrails="docker-compose run app bundle exec rails $1"
    alias dkcrake="docker-compose run app bundle exec rake $1"
    alias dkcrspec="docker-compose run app bundle exec rspec -fd $1"
    alias dkcreset="docker-compose run app bundle exec rake db:drop db:create db:migrate"
    alias dkcresetdb="docker-compose run app bundle exec rake db:drop db:create db:migrate db:seed"
    fi