Dock
A sweet remedy for all your docker problems
Dock is an handy command that plugs on top of your usual docker commands adding some sugar and some handy function on top of it.
What does it mean?
This:
~ ᐅ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b844c6472721 tutum/mysql:latest "/bin/sh -c 'export 3 seconds ago Up 3 seconds 0.0.0.0:4000->4000/tcp sharp_elion
~ ᐅ docker stop b844c6472721
b844c6472721
becomes this:
~ ᐅ dock stop tutum/mysql
running stop tutum/mysql d1ac1f9a916d on container d1ac1f9a916d
d1ac1f9a916d
Installation
Install this library through NPM:
npm install -g node-dock
Usage
Dock comes with 2 handy commands on top of the usual ones:
List
Get the list of all your current containers:
~ ᐅ dock listImage name: namshi/nginx-proxy:latest (id: 3563cd490f63)Image name: tutum/mysql:latest (id: d1ac1f9a916d)
Clean
Cleanup all your inactive ones:
~ ᐅ dock cleanrunning rm d1ac1f9a916d on container d1ac1f9a916dd1ac1f9a916d
Clean Images
And cleanup all your un-tagged images:
~ ᐅ dock clean imagesrunning rmi d56522c3164e on container d56522c3164erunning rmi f1365340886d on container f1365340886drunning rmi f6a404a7172d on container f6a404a7172drunning rmi 205d4782d521 on container 205d4782d521running rmi cea515493893 on container cea515493893running rmi 7af0498ecd5b on container 7af0498ecd5brunning rmi 41e666c0e178 on container 41e666c0e178running rmi f725abdabf27 on container f725abdabf27running rmi 19fb2516cde9 on container 19fb2516cde9running rmi 7523d53c4fea on container 7523d53c4fearunning rmi 533f6ceea42d on container 533f6ceea42drunning rmi 54b14e4b8f1a on container 54b14e4b8f1a
Run a docker command on a container, by image name
How many times you've dreamt of:
docker logs -f tutum/mysql
...now it's possible!
Whenever you create and run your new container you always know the image's name, but the id can be rather annoying to get every time.
Just add a --image || -i <name>
, or your image name as last
argument, in your usual docker
command and dock
will figure
out what to do for you :)
dock <command> <commandArgs> --image <imageName># ie:dock logs -f --image mikaelhg/docker-rabbitmq# ordock <command> <commandArgs> --i <imageName># or you can even omit the flagdock logs -f mikaelhg/docker-rabbitmq