Capturing JSON messages on their way to the docker server is a far more civilised way to extend docker than trying to "wrap" the docker cli.
In my use case - using the cli - I was struggling to separate the docker arguments from the image name and container args. It's better for docker itself to do that and more generally - its better to use the vanilla docker client (because orchestration tools).
As soon as I was working with the JSON messages generated by the docker client - everything became much easier!
Capturing JSON messages on their way to the docker server is a far more civilised way to extend docker than trying to "wrap" the docker cli.
In my use case - using the cli - I was struggling to separate the docker arguments from the image name and container args. It's better for docker itself to do that and more generally - its better to use the vanilla docker client (because orchestration tools).
As soon as I was working with the JSON messages generated by the docker client - everything became much easier!