Docker bash aliases - new bash shell commands to make working with Docker containers & images easier.
Save the docker_aliases.sh
file to your home directory. Rename it to .docker_aliases
and add this to your ~/.bashrc
file somewhere:
if [ -f ~/.docker_aliases ]; then
source ~/.docker_aliases
fi
Then either close & re-open your terminal windows or do this in each one to make it refresh:
$ . ~/bashrc
Installing docker_aliases
will get you some new commands to use in your bash terminal:
Like docker ps
, but with two extra columns on the end, showing the containers local IP address and it's current RAM usage. Looks like this:
$ dps
CONTAINER ID IMAGE ... NAMES IP RAM
0a3359f50829 23f1a66316b3 ... container-one 172.17.0.139 57 MB
63a1b8ab9fb5 037e0afb42e4 ... container-two 172.17.0.137 490 MB
c9bbee45d255 872fb65cee6d ... container-three 172.17.0.135 1696 MB
Accepts the same command line switches as docker ps
- i.e. dps -a
works.
Delete all containers & images, reset dockers container linking DB and restart docker. The nuclear option.
NB: Does not prompt for confirmation.
$ docker_wipe
List the volumes for a given container:
$ dvol <container name|id>