Skip to content

Allow to specify docker remote api version you want to use - #462

Closed
RunsFor wants to merge 2 commits into
upserve:masterfrom
RunsFor:runsfor/configure_docker_api_version
Closed

RunsFor wants to merge 2 commits into
upserve:masterfrom
RunsFor:runsfor/configure_docker_api_version

Conversation

@RunsFor

@RunsFor RunsFor commented Dec 26, 2016

Copy link
Copy Markdown

Hi,

Right now Docker::API_VERSION is hardcoded, so we cannot use the latest features of api.

For example, I have docker 1.12.5 installed (with api version 1.24 supported) and I was not able to get containers IPAddress when connected to user-defined docker bridge network.

I figured out that this feature (Show networks settings for each network when inspecting a container) was added in the api version 1.21. But gems code using 1.16 version each request.

Actually it's not required to explicitly specify version to use. Here is what docker documentation says about using api versions:

The current version of the API is v1.24 which means calling /info is the same as calling /v1.24/info.
To call an older version of the API use /v1.23/info.
If a newer daemon is installed, new properties may be returned even when calling older versions of the API.

Since I would like to use the latest docker api version, I propose this pull request, where user may specify his docker remote api version.

Actually I thought, that it is better to use the latest api version by default (do not explicitly specify any versions), but some tests was failing. So I did not modify default behaviour.

Docker supports multiple api versions. So if you want to stick with
particular version, you may specify it. You can do this through
Docker#api_version= method:

```ruby
Docker.api_version = '1.24'
```

- Added ability to specify docker remote api version
- Renamed Docker::API_VERSION to Docker::SUPPORTED_API_VERSION
- Raise error when specified version is less than supported version
- Added specs
@tlunter

tlunter commented Dec 26, 2016

Copy link
Copy Markdown
Contributor

Seeing as how most of this gem is made to just "work" with any version of the API, it's not that feasible to allow anyone to specify any version. That could really easily result in an extremely poor experience. If we were to make a change to support multiple versions of the API, we'd either need to maintain a compatible version of the gem for each API version, or specify different code paths for each version of the API. It's difficult to do this without releasing a new major version of the gem. Docker has made this increasingly difficult by not doing a good job versioning their API.

@RunsFor

RunsFor commented Dec 26, 2016

Copy link
Copy Markdown
Author

Yes, it seems like new major release needed.

Also, 1.16 version is pretty old now. Does docker actually support these versions? From this issue I see, that docker team do not support any versions different from the current. But they doing good with backward compatibility last time.

it's not that feasible to allow anyone to specify any version

Why not also specify supported versions in the gem? Something similar to what I did in PR

@tlunter WDYT about bumping a new release with latest api version supported? Isn't that what gem listed in the official documentation should do? :) What about write down some roadmap? I know, supporting multiple versions is hard, but we have to move on.

Thanks!

@tlunter

tlunter commented Dec 27, 2016

Copy link
Copy Markdown
Contributor

If I bump the API version listed to the latest, every person that is not using 1.12 is out of luck for any new changes or bug fixes. There are portions of the API that are not fully completed because someone hasn't had need of it. I won't release a major version change with something as simple as letting someone choose there own version. That'll lead to a lot of angry developers because it won't work with their applications like it currently does.

@tlunter tlunter closed this Dec 27, 2016
@seandilda

Copy link
Copy Markdown

@tlunter Would you be interested in upping to a new major version that supports newer docker commands while keeping versions with the lower version on docker 1.16?
We're also running into an issue related to not being able to use features that aren't available in docker 1.16, and would love to use a newer version of the API.

@clivecrous

Copy link
Copy Markdown

This is a complete blocker for those that need 1.24, eg when connecting to Windows Docker Hosts:

Docker::Error::ClientError: client version 1.16 is too old. Minimum supported API version is 1.24, please upgrade your client to a newer version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants