[solved] kubeneres docker plugins freezes building images, apk command

I’m running drone inside kubernetes. I installed it by hand, made the service/deployment for the drone/server and for the drone/drone-runner-kube (both using latest image).

I’m trying to build a docker image for an elixir/phoenix app using plugins/docker, but for some reason it seems to have different network issues:

  • apk add request hangs
  • curl gives OpenSSL SSL_connect: SSL_ERROR_SYSCALL
  • mix local.hex --force request timeouts
  • mix local.hex --force errors with (Mix) httpc request failed with: {:failed_connect, [{:to_address, {'repo.hex.pm', 443}}, {:inet, [:inet], :closed}]}

Dockerfile:

FROM elixir:1.9.2-alpine as deps
WORKDIR /opt/project/
RUN apk add curl
COPY mix.exs mix.lock ./
RUN mix local.hex --force
RUN mix deps.get --only prod

.drone.yml

---
kind: pipeline
type: kubernetes
name: default

steps:
- name: build-image
  image: plugins/docker
  settings:
    username:
      from_secret: docker_username
    password:
      from_secret: docker_password
    registry: registry.example.com
    repo: registry.example.com/project
    tags: latest
1 Like

Please note the kubernetes runner is still experimental. We are accepting pull requests at https://github.com/drone-runners/drone-runner-kube

Oh…

Did not know that, will try using some other runner to see if it is an issue with the kubernetes runner.

Solved the issue, it wasn’t the kubernetes runner fault.

Since I’m running docker in docker in docker (give or take a level) the docker daemon container created by plugins/docker is created with a bad MTU value of 1500 when it should be 1440 (at least in my case).

To fix it I just added this to my .drone.yml:

environment:
    PLUGIN_MTU: 1440

Source of my solution: https://medium.com/@liejuntao001/fix-docker-in-docker-network-issue-in-kubernetes-cc18c229d9e5

1 Like

also note that you can set the mtu value using the following setting (as opposed to using the environment variable):

steps:
- name: build
  image: plugins/docker
  settings:
    mtu: <value>
1 Like

had the same problem, drone’s docker plugin failing apparently after the APK command.
After trying everything for hours the above suggestion fixed it for me!
thanks!