If you work with docker, and like me, don’t like to use UIs but the terminal to express what you want, this article may help you.

All we know that many devs spend tons of hours using the terminal, although it’s cool, sometimes it can become a pain when the things you want to express are too long, that’s what’s been happening to me with docker, you should know what I mean.

That’s why I want to show you how to create custom commands and comfortable interactive menus in your terminal by using the amazing project FuzzyFinder to make your life easier.

fzf is a general-purpose command-line fuzzy finder that can be used to create custom interactive menus from the terminal, learn more in the github repository, first of all install fzf in your system:

git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf  

I’ve made the hardest part for you by learning bash and coding all the examples in this article, to make it work, you just have to add them to your .bash_profile and reload it in your current session, by the way, Bash 4 is a requirement to make them work.

vim ~/.bash_profile     # edit  
source ~/.bash_profile  # reload

Running containers

The first command is runc, which is from now an amazing command to run a new container by selecting the docker image from a interactive menu

Runs a docker container from an image

Running commands in already running containers

Sometimes you just need to run a command in already running container, but it’s pretty annoying to list all the running containers just to get the container’s ID or name, now you can have runinc

Runs a command in already running docker container

Stopping/Removing containers

Stop or a remove a container choosing it from a fancy menu, removing is optional.

Stops and/or removes a docker container

Getting the container’s IP Address

Inspect the IP address quickly choosing the container from the menu by running showipc

As you can see, these are just few examples about how to operate with fzf and docker, you can adapt them to make them work as you want, hope you find it useful and suggestions or new commands are welcome.