fetch-proxy Only works with the latest Docker API
hskrtich opened this issue · 8 comments
I have been testing out the new version of fetch-proxy and the way it is currently setup it will only ever connect to docker with the latest API. This breaks compatibility with all previous versions of docker.
From what I can tell the only problem is that a minimum version needs to set which can be done 2 ways. With using NewEnvClient() (*Client, error)
then an env var of DOCKER_API_VERSION needs to be set or you can use NewClient(host string, version string, client *http.Client, httpHeaders map[string]string) (*Client, error)
Ether way, with the code written as is I think you can use the oldest version of the API which is v1.18. Which would mean it would be compatible with docker 1.6.x and up.
FYI I got this info from https://docs.docker.com/engine/api/version-history/ and https://godoc.org/github.com/docker/docker/client#NewClient
My recommendation would be to use NewClient(host string, version string, client *http.Client, httpHeaders map[string]string) (*Client, error)
and hardcode the values. They shouldn't need to be changed.
Weird. Sorry for the delay. I thought I already responded to this but I guess not!
I've got a lot of functionality I'd like to add that requires the latest and greatest docker. I left automagicproxy on the dockerhub specifically for RP(so I could upgrade without breaking your stuff, hence the name change).
I know you guys can't upgrade as quickly/easily but I'd recommend upgrading to something a bit more modern. If you can't, I'd recommend forking this repo at commit id 0c4637093920bfb7096108b2dc6ca4cf521bdffb
Hope you're well @bskrtich!
I would at least recommend fixing the api version to whatever version you need currently for the features you want. A LOT of distributions do not put out the latest as soon as its released. Its very normal to lag behind one or 2 versions. Thats not an RP thing, its a linux distro thing.
I see and understand your point.
docker v1.6 came out ~2 years ago(https://blog.docker.com/2015/04/docker-release-1-6/). I don't really want to support things for 2+ years.
I think at this point, given the back and fourth, it would probably be best if RP used https://github.com/containous/traefik. Or feel free and fork this repo at the commit Id I referenced earlier in the previous comment.
Traefik I think would be a drop in replacement for you.
well my point was I cant use this software on my own personal projects because of the api version requirements. so yea i guess at this point i will find something that will work better.
Submit a PR then and I'll merge it.
actually ... because it's newEnvClient() you can just pass in an env variable DOCKER_API_VERSION
and it should pick it up just fine.
ninja edit
docker run -d -p 80:80 -p 443:443 -v /var/run/docker.sock:/var/run/docker.sock --restart=always -e DOCKER_API_VERSION=1.24 --name fetch-proxy kcmerrill/fetch-proxy
^^^ I tested this with an old ass version of docker and it worked(was broken with defaults)
yea im running it with DOCKER_API_VERSION=1.18 and it works just fine.