-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query parameters aren't passed correctly to the Rest interface #6
Comments
I've come across the same problem. After juggling around with the code I've found that if I change the Joi definition for the tasks list command from const taskList = await client.tasks().list({filters: `{"service": {"${id}": true}}`}); and it all works. I see that you don't have quotes around 'service' which didn't seem to work for me--the Docker API seems to require the quotes around each object property (i.e., proper JSON). Although the API docs talk about the service name I found that I could use either the service name or the service ID and it works fine. I could try and do a pull request but my suspicion is that this problem exists in other functions that take parameters, and I'm not sure I have enough knowledge of the Docker API to make the changes across other functions. |
I can confirm this is a problem, and it is indeed due to the way the query string parameters are converted. My example:
The above produces this in the engine log:
The request library is fed the following options:
To get the same information from the command line, we'd run Which produces this in the engine logs:
The key differences being that, when you compare each query string, you get |
I believe @markbirbeck was on the right track by validating Given:
The request library converts
I think a decent solution might be to do something like this at https://github.com/arhea/harbor-master/blob/master/lib/modem.js#L134
Handling the EDIT: FYI making the above change, I get exactly my desired container listing. |
I ended up writing my own with the following differences:
If it's of interest, see docker-engine. |
This looks excellent. Keen on trying this out in an upcoming project. Thanks @markbirbeck. |
The docker docs are pretty bad for optional args to any of the commands but
To filter a service by name in the task API you need a request of the form
curl -v --unix-socket /var/run/docker.sock -X GET http:/v1.32/tasks?filters=%7B%22service%22%3A%7B%22service_name%22%3Atrue%7D%7D
The request library is restructuring the query part of the URI to something like
curl -v --unix-socket /var/run/docker.sock -X GET http:/v1.32/tasks?filters[service[service_name]]=true
I'm using the tasks endpoint with options of
{filters: {service: {"service_name": true}}}
The text was updated successfully, but these errors were encountered: