GoogleContainerTools / skaffold

Easy and Repeatable Kubernetes Development
https://skaffold.dev/
Apache License 2.0
14.93k stars 1.62k forks source link

Wrong host for docker API calls when using an ssh DOCKER_HOST #9484

Open aran opened 1 month ago

aran commented 1 month ago

Expected behavior

When setting a ssh-based DOCKER_HOST, e.g. ssh://docker@127.0.0.1, expect skaffold to work if 'docker' CLI works.

The broader goal is to allow using a remote server, e.g. running on a GCP instance, as the execution context for development, without the performance or ergonomic overhead of a container registry.

Actual behavior

Even though 'docker' CLI tool works, skaffold's set up of the docker API calls use a dummy hostname, which then fails, e.g. http://docker.example.com/v1.44/version

The specific failure on my system looks like:

build [my_image] failed: invalid character '<' looking for beginning of value, which is due to receiving an HTML response for http://docker.example.com from my ISP AT&T's DNS failure interceptor, and then the ServerVersion() API attempts to parse the HTML as JSON.

Without the DNS, the error is instead error during connect: Get "http://docker.example.com/v1.44/version": dial tcp: lookup docker.example.com: no such host

Information

Steps to reproduce the behavior

  1. Get a ssh-based DOCKER_HOST, e.g. from minikube -p $MINIKUBE_PROFILE docker-env --ssh-host=true on another machine
  2. Ensure ssh is set up, e.g. ssh-add ~/.minikube/machines/$MINIKUBE_PROFILE/id_rsa
  3. Ensure ssh works: ssh -v -l docker -p $MINIKUBE_SSH_PORT -- 127.0.0.1
  4. Double-check that regular docker works, e.g. docker images or docker version
  5. skaffold dev
wojtyniak commented 2 weeks ago

I'm observing the same issue on my side.