Docker Compose: Some aliases for increase your productivity

Speaking about Docker Compose there are various native different commands to memorize, for managing docker images, getting docker info etc etc..
On my personal workflow, since I quite often use Dockers, I decided to implement some bash aliases, which I include in .bashrc of ally my Linux machine, if I need to work with Dockers.

Here’s the full list of personal commands I decided to implement:

1.opendockershellbash() { sudo docker exec -ti $1 bash; }
For open a running docker interactive console, in bash mode

2.opendockershellsh() { sudo docker exec -ti $1 /bin/sh; }
For open a running docker interactive console, in bin/sh mode

3.getdockerip() { sudo docker inspect $1 | grep IPAdd; }
For getting a running docker image IP address information

4.alias dockerup="sudo docker-compose up"
For turn on a docker image

5.alias dockerdaemon="sudo docker-compose up -d"
For turn on a docker image in a separate daemon

6.alias dockerdown="sudo docker-compose down"
For turn off a docker image

7.alias dockerrunninglist="sudo docker ps"
For get a list of all current running docker images

8.alias dockerimagelist="sudo docker image ls"
For get a list of all docker images

9.turnoffalldocker() { sudo chown $USER /var/run/docker.sock && sudo docker stop $(docker ps -a -q); }
For istantly turn off all docker running docker images

10.killalldocker() { sudo chown $USER /var/run/docker.sock && sudo docker rmi -f $(docker images -a -q); }
For istantly turn off and remove all docker images

What do you guys think about my approach to Docker (instead memorize all the native commands)? Are there some commands you might add on this list? Feel free to say anything, I’m always curious to learn from you.

1 Like

Nice one! For most tasks I use oxker or lazydocker

1 Like

Could you give more details please :slight_smile:

1 Like

Sure.
Oxker and lazydocker gives you the possibility to start, stop, restart, delete, view logs and some stats

Oxker

Lazydocker

Pretty sure both are written in rust

1 Like

@toadie thanks for share! It’s always a pleasure discover new tools

1 Like