Search code examples
dockerubuntukubernetesminikubeskaffold

Skaffold dev fails


I am having this error, after running skaffold dev.

Step 1/6 : FROM node:current-alpine3.11
exiting dev mode because first build failed: unable to stream build output: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 192.168.49.1:53: read udp 192.168.49.2:35889->192.168.49.1:53: i/o timeout. Please fix the Dockerfile and try again..

Here is skaffold.yml

apiVersion: skaffold/v2beta11
kind: Config
metadata:
  name: *****
build:
  artifacts:
    - image: 127.0.0.1:32000/auth
      context: auth
      docker:
        dockerfile: Dockerfile
deploy:
  kubectl:
    manifests:
      - infra/k8s/auth-depl.yaml
  local:
    push: false
  artifacts:
    - image: 127.0.0.1:32000/auth
      context: auth
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: "src/**/*.ts"
            dest: .

I have tried all possible solutions I saw online, including adding 8.8.8.8 as the DNS, but the error still persists. I am using Linux and running ubuntu, I am also using Minikube locally. Please assist.


Solution

  • This is a Community Wiki answer, posted for better visibility, so feel free to edit it and add any additional details you consider important.

    In this case:

    minikube delete && minikube start
    

    solved the problem but you can start from restarting docker daemon. Since this is Minikube cluster and Skaffold uses for its builds Minikube's Docker daemon, as suggested by Brian de Alwis in his comment, you may start from:

    minikube stop && minikube start
    

    or

    minikube ssh
    su
    systemctl restart docker
    

    I searched for similar errors and in many cases e.g. here or in this thread, setting up your DNS to something reliable like 8.8.8.8 may also help:

    sudo echo "nameserver 8.8.8.8" >> /etc/resolv.conf
    

    in case you use Minikube you should first:

    minikube ssh
    
    su ### to become root
    

    and then run:

    echo "nameserver 8.8.8.8" >> /etc/resolv.conf
    

    The following error message:

    Please fix the Dockerfile and try again
    

    may be somewhat misleading in similar cases as Dockerfile is probably totally fine, but as we can read in other part:

    lookup registry-1.docker.io on 192.168.49.1:53: read udp 192.168.49.2:35889->192.168.49.1:53: i/o timeout.
    

    it's definitely related with failing DNS lookup. This is well described here as well known issue.

    Get i/o timeout

    Get https://index.docker.io/v1/repositories//images: dial tcp: lookup on :53: read udp :53: i/o timeout

    Description

    The DNS resolver configured on the host cannot resolve the registry’s hostname.

    GitHub link

    N/A

    Workaround

    Retry the operation, or if the error persists, use another DNS resolver. You can do this by updating your /etc/resolv.conf file with these or other DNS servers:

    nameserver 8.8.8.8 nameserver 8.8.4.4