docker-machine prompt

In playing with Docker on various cloud providers I thought it would be nice to add the current docker host info the the prompt. First I created a function in my .bashrc to set the docker environment variables from machine.

dme(){
    eval $(docker-machine env $@)
}

Then created another function and added it to PS1 to show the currently active machine. Here it is in action:


[ ~ ]$ dme default
[{🐳 default: 192.168.99.100} ~ ]$ dme default2
[{🐳 default2: 192.168.99.101} ~ ]$

Enjoy!

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s