Skip to content
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

What would be the best way to specify version of docker api, so that go-dockerclient can adjust requests and response expectations accordingly? #920

Closed
kevintoormimik opened this issue May 24, 2022 · 4 comments
Labels

Comments

@kevintoormimik
Copy link

Context

I am creating a shim docker API service i.e., basically the service pretends to be docker and responds like docker. Requests are partially forwarded to docker engine and remainder (container or image related) are forwarded to a different container runtime.

The piece of software using this shim service uses go-dockerclient library.

Solution tried

I tried to return the version of docker API supported by the shim service as a response to GET /version request coming from the go-dockerclient lib.

The shim service responded by requesting the actual docker engine for response and replacing values for response.ApiVersion and response.MinAPIVersion with the supported version (1.41).

The solution did not work, can you please confirm if I am missing something, or if there is a better way of doing it

@playground

@kevintoormimik kevintoormimik changed the title What would be the way to specify version of docker api so that go-dockerclient can adjust requests and response expectations accordingly? What would be the best way to specify version of docker api, so that go-dockerclient can adjust requests and response expectations accordingly? May 24, 2022
@fsouza
Copy link
Owner

fsouza commented Jun 1, 2022

Does NewVersionedClient (or some of the variants) work for you?

@kevintoormimik
Copy link
Author

@fsouza I am not using the library directly, instead, another software Anax (open-horizon/anax) is using go-dockerclient. So interactions looks like this:

Docker Engine (calls are only forwarded if Shim does not want to respond directly) <-> Shim <-> Anax (software which is using go-dockerclient)

In this setup, is there a point in which go-dockerclient would send request to see what docker API version to use to interact with Docker Engine (in our case with Shim instead initially), so that Shim can interject can report its own supported docker API version?

OR

Whats the criteria used by go-dockerclient to decide which docker API version to use if NewVersionedClient is not used?

P.S. I accidentally closed the issue, so reopened.

@fsouza
Copy link
Owner

fsouza commented Jun 1, 2022

Hmm, I think this should be an issue/feature-request in anax then.

Whats the criteria used by go-dockerclient to decide which docker API version to use if NewVersionedClient is not used?

In that case, go-dockerclient doesn't use versioned URLs, which means the latest supported by the remote Docker engine.

@kevintoormimik
Copy link
Author

Understood. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants