vito / bass

a low fidelity scripting language for project infrastructure
https://bass-lang.org
MIT License
378 stars 13 forks source link

Using bass behind a proxy: pulling buildkit image with docker setup #237

Open pfiaux opened 2 years ago

pfiaux commented 2 years ago

Displayed error message It's not really a bug and the error is kinda cryptic although I know what the issues I would like to discuss if there are options beyond the error message to make this easier to use.

error   failed to pull buildkit image   {
  "version": "v0.10.3",
  "error": "exit status 1",
  "output": "Error response from daemon: Get \"https://registry-1.docker.io/v2/\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)\n"
}
init buildkit runtime for platform os=linux, arch=any: 
list buildkit workers:
failed to list workers:
Unavailable: connection error: desc = "transport: Error while dialing dial unix /run/buildkit/buildkitd.sock:
connect: no such file or directory"

(line breaks mine for readability)

To Reproduce This is not a fun one to reproduce...

# Setup a proxy
# Setup a firewall that drops all out going traffic not using the proxy
# Join the network using this firewall
# Make sure the computer has Docker Desktop installed (macOS)
bass

After a while the error message above will likely be shown because when bass fails to pull an image without using the proxy.

Other relevant notes:

Suggested message What would have helped you identify the root cause quicker?

# maybe before the error a hint about no buildkit detected, fetching `basslang/buildkit` (from dockerhub)

Unable to fetch `basslang/buildkit` to start a buildkit instance:
  request canceled while waiting for connection
  (Client.Timeout exceeded while awaiting headers)
  to https://registry-1.docker.io/v2

Make sure xyz or try to manually setup a bass buildkit server according to xyz* (see discussion below)

Beyond the error to resolve the problem I can think of 2 things:

I'm not sure it's possible to override docker's pull settings dynamically so probably not much can be done about the first for Docker Desktop.

The second however would at least in some cases solve the problem. If a private registry is available internally (without proxy), prefixing the image name with another url than https://registry-1.docker.io/v2/ would allow using a mirror (also nice to avoid hitting rate limitations from docker hub). Do you think adding something like DEFAULT_IMAGE_REGISTRY_URL would be possible? At least for the buildkit image, perhaps it can be used for scripts after that if the url is not provided as well.