bazel-contrib / bazel-contrib/rules_oci

Running on Windows from different drive than C:\

Open
#427 0 comments 0 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
Starlark
Stars
423
Forks
213
Avg merge
53m
Merged PRs (30d)
1

Description

(Copied verbatim from https://github.com/malkia/oci/tree/ec07528e1bf01c23650aa2f9915c2c102cffb986)

- Running from drive different than your `%USERPROFILE%` one (typically `C:`), for example on `D:\` would try to read `\Users\\.docker\config.json` (I've replaced my username with `` below)

ERROR: : fetching oci_alias rule //:rules_oci~1.4.3~oci~distroless_base: Traceback (most recent call last):
File "C:/users//_bazel_/roe7hhvn/external/rules_oci~1.4.3/oci/private/pull.bzl", line 472, column 36, in _oci_alias_impl
downloader = _create_downloader(rctx)
File "C:/users//_bazel_/roe7hhvn/external/rules_oci~1.4.3/oci/private/pull.bzl", line 318, column 40, in _create_downloader
"config": _get_auth_config_path(rctx),
File "C:/users//_bazel_/roe7hhvn/external/rules_oci~1.4.3/oci/private/pull.bzl", line 312, column 37, in _get_auth_config_path
return json.decode(rctx.read(path))
Error in read: java.io.FileNotFoundException: \Users\\.docker\config.json (The system cannot find the path specified)
ERROR: java.io.FileNotFoundException: \Users\\.docker\config.json (The system cannot find the path specified)

- Workaround
* Not best workaround, but setting `DOCKER_CONFIG` to some value in `.bazelrc` _"fixes"_ this

common --repo_env=DOCKER_CONFIG=does_not_matter

* It reports now:

WARNING: Could not find the `$HOME/.docker/config.json` and `$XDG_RUNTIME_DIR/containers/auth.json` file. Running one of `podman login`, `docker login`, `crane login` may help.

Contributor guide

Open the contributing guide

Research direction

Start by reading oci/private/pull.bzl, especially _get_auth_config_path and _create_downloader, using the reported Windows error as the reproduction context. Verify how the Docker config path is formed when the project runs from a drive other than C:. Done means the path no longer incorrectly resolves to \Users\... and the workaround setting DOCKER_CONFIG is unnecessary.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.