skaffold: skaffold build: failed to connecto to docker socket

Expected behavior

App gets built

Actual behavior

Error message:

===> ANALYZING
[analyzer] ERROR: failed to initialize docker client: failed to connect to docker socket: dial unix /var/run/docker.sock: connect: connection refused
couldn't build "gcr.io/k8s-skaffold/skaffold-buildpacks": executing lifecycle. This may be the result of using an untrusted builder: failed with status code: 1

Information

  • Skaffold version: v1.13.2
  • Operating system: Ubuntu running inside WSL2 on Windows 10
  • Contents of skaffold.yaml:
apiVersion: skaffold/v2beta5
kind: Config
build:
  artifacts:
  - image: gcr.io/k8s-skaffold/skaffold-buildpacks
    buildpacks:
      builder: "gcr.io/buildpacks/builder:v1"

The pack command seems to get further:

$ go run github.com/buildpacks/pack/cmd/pack build charlie/flask --builder gcr.io/buildpacks/builder:v1
v1: Pulling from buildpacks/builder
Digest: sha256:7811ff307f0b99c76d8f97a2166954d011e447529ae5c6688c042f3119052c58
Status: Image is up to date for gcr.io/buildpacks/builder:v1
v1: Pulling from buildpacks/gcp/run
Digest: sha256:de0fd481b8156bba03e80a4544fca2d6cbcdf6bcac3c1e9aeb6fc364ccfae54a
Status: Image is up to date for gcr.io/buildpacks/gcp/run:v1
===> DETECTING
google.python.runtime            0.9.0
google.python.missing-entrypoint 0.9.0
google.utils.label               0.0.1
===> ANALYZING
Previous image with name "index.docker.io/charlie/flask:latest" not found
===> RESTORING
===> BUILDING
=== Python - Runtime (google.python.runtime@0.9.0) ===
Using latest runtime version: 3.8.2
Installing Python v3.8.2
Upgrading pip to the latest version and installing build tools
--------------------------------------------------------------------------------
Running "/layers/google.python.runtime/python/bin/python3 -m pip install --upgrade pip setuptools wheel"
Collecting pip
  Downloading https://files.pythonhosted.org/packages/5a/4a/39400ff9b36e719bdf8f31c99fe1fa7842a42fa77432e584f707a5080063/pip-20.2.2-py2.py3-none-any.whl (1.5MB)
Collecting setuptools
  Downloading https://files.pythonhosted.org/packages/6d/ed/52e05469314a266f68d9f251a8c1ab7a21a03327b1724056e3eea654bfd1/setuptools-50.0.3-py3-none-any.whl (784kB)
Collecting wheel
  Downloading https://files.pythonhosted.org/packages/a7/00/3df031b3ecd5444d572141321537080b40c1c25e1caa3d86cdd12e5e919c/wheel-0.35.1-py2.py3-none-any.whl
Installing collected packages: pip, setuptools, wheel
  Found existing installation: pip 19.2.3
    Uninstalling pip-19.2.3:
      Successfully uninstalled pip-19.2.3
  Found existing installation: setuptools 41.2.0
    Uninstalling setuptools-41.2.0:
      Successfully uninstalled setuptools-41.2.0
Successfully installed pip-20.2.2 setuptools-50.0.3 wheel-0.35.1
Done "/layers/google.python.runtime/python/bin/python3 -m pip inst..." (2.8032094s)
=== Python - pip (google.python.missing-entrypoint@0.9.0) ===
Failure: (ID: 194879d1) Failed to run /bin/build: for Python, an entrypoint must be manually set, either with "GOOGLE_ENTRYPOINT" env var or by creating a "Procfile" file
--------------------------------------------------------------------------------
Sorry your project couldn't be built.
Our documentation explains ways to configure Buildpacks to better recognise your project:
 -> https://github.com/GoogleCloudPlatform/buildpacks/blob/main/README.md
If you think you've found an issue, please report it:
 -> https://github.com/GoogleCloudPlatform/buildpacks/issues/new
--------------------------------------------------------------------------------
ERROR: failed to build: exit status 1
ERROR: failed to build: failed with status code: 145
exit status 1

Docker works fine:

$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
$ docker context ls
NAME                DESCRIPTION                               DOCKER ENDPOINT               KUBERNETES ENDPOINT   ORCHESTRATOR
default *           Current DOCKER_HOST based configuration   unix:///var/run/docker.sock                         swarm
$ echo $DOCKER_HOST

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19 (7 by maintainers)

Most upvoted comments

Error response from daemon: not a directory
Error response from daemon: page not found

From these errors, at least it seems like you can connect to the docker socket from Skaffold after you upgraded Docker.

I speculated that the “page not found” error response from the daemon might be because of API version mismatch between the client and the server (e.g., hitting a wrong endpoint, hence “page not found”). But obviously, your server and client are using the same version, so I guess it’s not the cause. It may just be logging that there’s no containers to force-delete.

For the “not a directory” response, I just have a wild speculation that some internal Docker daemon state is corrupted or to that effect. For example,

https://stackoverflow.com/a/45104143/1701388 https://stackoverflow.com/a/56090070/1701388

Maybe try cleaning up everything (running/stopped containers, all the images, but especially all the volumes that are both being used and unused, …). But at least you are getting a response from the daemon, so I think your original issue that you cannot connect to the daemon is resolved somehow.

But I’m not a Docker expert, and all I said may just be wrong.