Hacker News new | ask | show | jobs
by tniswong 3803 days ago
I just use bash aliases in my .profile

----

alias dm="docker-machine"

alias dc="docker-compose"

alias denv='function __denv() { eval "$(dm env $@)"; unset -f __denv; }; __denv'

----

dm create --driver virtualbox local

denv local

Also works with swarm params:

denv local --swarm swarm-master

3 comments

The whole Quay team at CoreOS uses OSX to develop a container registry. As a result I have a bunch of useful aliases as well[0]. A lot of them have to do with just plain cleaning up after yourself, but I also wrap my calls to `docker` with a zsh function that will eval my dev docker-machine environment if it hasn't been already.

[0]: https://github.com/jzelinskie/dotfiles/blob/b2d33f8c601d1b7d...

Thanks for this, I'd been typing way too much for too long. However, dc overlaps with the dc program so I've moved to dkm and dkc (since I actually use dc from time to time.)
Mine are similar:

dssh() { docker exec -ti $1 /bin/bash }

dexec() { img="$1" shift docker exec $img /bin/sh -c "$@" }