I would like to send the docker engine the HTTP requests by myself and not with the docker CLI.
Is there any way to dynamically convert the docker CLI commands to docker API packets without implementing a full parser by myself?
I use Python and the Docker SDK for Python module. The idea is to implement a “wrapper” around the docker run CLI command. So the tool I’m working on could take the same input as the original run command would. To achieve this I implemented a parameter converter, which you can find here. Although this function only handles a very small subset of the possible parameters, which are sufficient for me at moment, later it would be nice to cover all the params. I guess the easiest solution would be to use the Docker CLI as a subprocess, but in the future, I would like to send commands to multiple remote Docker Engines simultaneously, which is quite difficult with the Docker CLI. Is there any (most optimally Python) lib that does the conversion for all supported parameters and keeps up to date with the API releases?
Ákos, sorry for the late answer.
I’m afraid that could lead to problems in the future. For example, the DEM (the tool in question) is working in the background, while the user tries to interact with the local Docker Engine using the CLI. Since the DOCKER_HOST points to a remote host, the issues CLI command will be executed there.
Now I try to use the context feature. I just started to dig into this topic, but I think it should solve the aforementioned problem.