Thursday 2 February 2017

Docker Management Commands


The recent release of Docker 1.13.0 saw some interesting updates. One of the feature that really interests me is the release of the Docker Management Commands.



The need:

As an example, consider the following docker command:$ docker rm


When typing these commands, there is often the confusion in the minds of the user if we need to provide an image id or does this apply to container id. Often this resulted in looking up for help which would tell you what was expected, as given below:$ docker rm
“docker rm” requires at least 1 argument(s).
See ‘docker rm — help’.
Usage: docker rm [OPTIONS] CONTAINER [CONTAINER…]
Remove one or more containers


This is now addressed in Docker 1.13.0 with the release of Management Commands. If you simply type docker at the terminal, you will see the section on Management Commands as given below:Management Commands:
checkpoint Manage checkpoints
container Manage containers
image Manage images
network Manage networks
node Manage Swarm nodes
plugin Manage plugins
secret Manage Docker secrets
service Manage services
stack Manage Docker stacks
swarm Manage Swarm
system Manage Docker
volume Manage volumes


So if you are dealing with images, you know that you can begin your command logically with$ docker image <command>


or if you are dealing with containers, it should logically be:$ docker container <command>


This is good design in my opinion and it is something that I have seen across other Command Line Interfaces (CLI) too, that make you mentally decide which resource you want to manage and then there would be typically commands like listing, adding, removing, monitoring, etc.

No comments:

Post a Comment