Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Setup docker agent version to 1.24 #775

Closed
wants to merge 1 commit into from
Closed

Setup docker agent version to 1.24 #775

wants to merge 1 commit into from

Conversation

clayrisser
Copy link

This fixes issue #774

@rawmind0
Copy link
Contributor

Hi @codejamninja , thanks for this PR.

This issue is related to harness/harness#2048 . This issue just happens if you are using docker server 1.12 or below, due to it don't let newer clients to connect. Using DOCKER_API_VERSION env variable at drone agent image, make docker client to downgrade to corresponding api version.

Hardcoding and forcing the api client downgrade is not a good solution:

  • If you are using docker 1.3.1 or higher you don't get this issue and DOCKER_API_VERSION env var is not needed.
  • If you are using docker 1.11 or above, this solution wouldn't work. Other value needed for DOCKER_API_VERSION env var. api versioning

I propose you to add an enum question at rancher-compose.yml file like,

+    - variable: docker_version
+      label: Docker Version
+      description: |
+        Docker version used. Downgrade docker client at drone agent if needed. 
+        Just needed if you are using Docker version 1.13.0 or below "
+      type: enum
+      default: ""
+      required: false
+      options:
+        - 1.13.0
+        - 1.12.x
+        - 1.11.x
+        - 1.10.x
+        - 1.9.x

Then at docker-compose.yml.tpl file set a question to add DOCKER_API_VERSION env var with proper value from api versioning, if needed.

  agent:
    image: drone/agent:${drone_version}
    environment:
      DRONE_SERVER: ${drone_server}
      DRONE_SECRET: ${drone_secret}
+  {{- if ne .Values.docker_version ""}}
+    {{- if eq ..Values.docker_version "1.13.0" }}
+      DOCKER_API_VERSION: 1.25
+    {{- end}}
+    {{- if eq ..Values.docker_version "1.12.x" }}
+      DOCKER_API_VERSION: 1.24
+    {{- end}}
+    {{- if eq ..Values.docker_version "1.11.x" }}
+      DOCKER_API_VERSION: 1.23
+    {{- end}}
+    {{- if eq ..Values.docker_version "1.10.x" }}
+      DOCKER_API_VERSION: 1.22
+    {{- end}}
+    {{- if eq ..Values.docker_version "1.9.x" }}
+      DOCKER_API_VERSION: 1.21
+    {{- end}}
+  {{- end}}

What do you think??

@cjellick
Copy link
Contributor

cjellick commented Aug 1, 2020

Closing this due to staleness. Feel free to reopen or open a new PR if there's still a relevant change to be made. Thanks!

@cjellick cjellick closed this Aug 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants