Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

pack builder ignores DOCKER_HOST #1409

Closed
radriaanse opened this issue May 4, 2021 · 0 comments · Fixed by #1457
Closed

pack builder ignores DOCKER_HOST #1409

radriaanse opened this issue May 4, 2021 · 0 comments · Fixed by #1457
Labels
bug Something isn't working plugin/pack
Milestone

Comments

@radriaanse
Copy link
Contributor

Describe the bug

When using the pack builder the DOCKER_HOST environment variable doesn't seem to be respected.
This causes the build to fail when the Docker socket is on a different location as default /var/run/docker, for example when running in rootless mode.

Interestingly the variable is properly used when creating the initial build pack container

client.FromEnv,

When I capture the analyzer container using docker inspect it shows the socket mount to the wrong path (abbreviated output);

{
  "Id": "5baa0c8737efe0045d39d3f41b69dc5aed72204a383cf243fbdffb7c16d5746c",
  "Created": "2021-05-04T12:56:29.277985308Z",
  "Path": "/cnb/lifecycle/analyzer",
  "Args": [
    "-daemon",
    "-cache-dir",
    "/cache",
    "-layers",
    "/layers",
    "index.docker.io/library/go:latest"
  ],
  "HostConfig": {
    "Binds": [
      "/var/run/docker.sock:/var/run/docker.sock",
      "pack-cache-fec58b24b18f.build:/cache",
      "pack-layers-htmzbpxzfb:/layers",
      "pack-app-mekfvmheeo:/workspace"
    ]
  },
  "Mounts": [
    {
      "Type": "bind",
      "Source": "/var/run/docker.sock",
      "Destination": "/var/run/docker.sock",
      "Mode": "",
      "RW": true,
      "Propagation": "rprivate"
    }
  ],
  "Config": {
    "Env": [
      "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
      "CNB_USER_ID=1000",
      "CNB_GROUP_ID=1000",
      "STACK=heroku-18",
      "CNB_STACK_ID=heroku-18"
    ],
    "Cmd": [
      "/cnb/lifecycle/analyzer",
      "-daemon",
      "-cache-dir",
      "/cache",
      "-layers",
      "/layers",
      "index.docker.io/library/go:latest"
    ],
    "Image": "pack.local/builder/7474787872686a736b68:latest",
    "Volumes": null
  }
}

Steps to Reproduce

> echo $DOCKER_HOST
unix:///run/user/1000/docker.sock
project = "testing"

app "go" {
    build {
        use "pack" {}
    }

    deploy {
        use "docker" {}
    }
}
> waypoint up -v
...
 │ 2021/05/04 14:48:31.390228 INFO:   ===> DETECTING
 │ [detector] ======== Output: heroku/ruby@0.0.1 ========
 │ [detector] no
 │ [detector] err:  heroku/ruby@0.0.1 (1)
 │ [detector] heroku/go       0.3.1
 │ [detector] heroku/procfile 0.6.2
 │ 2021/05/04 14:48:31.913333 INFO:   ===> ANALYZING
 │ [analyzer] ERROR: failed to initialize docker client: failed to connect to docke
 │ r socket: dial unix /var/run/docker.sock: connect: connection refused
! failed with status code: 1
2021-05-04T14:48:32.312+0200 [WARN]  waypoint: context cancelled, stopping interrupt listener loop

Expected behavior
Would it be possible for Waypoint to inform CNB about the different location?

Waypoint Platform Versions
Additional version and platform information to help triage the issue if
applicable:

  • Waypoint CLI Version: v0.3.1 (b550e5ce)
  • Waypoint Server Platform and Version: v0.3.1
  • Waypoint Plugin: pack & docker
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working plugin/pack
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants