rules_docker icon indicating copy to clipboard operation
rules_docker copied to clipboard

Build Failing - %1 is not a valid Win32 application

Open GeorgeWillaman opened this issue 3 years ago • 3 comments

🐞 bug report

Affected Rule

container_pull, py3_image

Is this a regression?

No (as far as I know)

Description

When I try to build my docker image:

bazel build src/cognancy:hello_world_image I receive %1 is not a valid Win32 application.. I am not sure if I need to change host_platform, as to my knowledge the default should be my current environment.

🔬 Minimal Reproduction

WORKSPACE/BUILD files

🔥 Exception or Error


INFO: Build option --define has changed, discarding analysis cache.
INFO: Repository py3_image_base instantiated at:
  C:/users/gwill/desktop/cognancy/WORKSPACE:23:16: in 
  C:/users/gwill/_bazel_gwill/fconqaj6/external/io_bazel_rules_docker/python3/image.bzl:55:23: in repositories
Repository rule container_pull defined at:
  C:/users/gwill/_bazel_gwill/fconqaj6/external/io_bazel_rules_docker/container/pull.bzl:212:33: in 
ERROR: An error occurred during the fetch of repository 'py3_image_base':
   Traceback (most recent call last):
        File "C:/users/gwill/_bazel_gwill/fconqaj6/external/io_bazel_rules_docker/container/pull.bzl", line 175, column 13, in _impl
                fail("Pull command failed: %s (%s)" % (result.stderr, " ".join([str(a) for a in args])))
Error in fail: Pull command failed: java.io.IOException: ERROR: src/main/native/windows/process.cc(202): CreateProcessW("C:\users\gwill\_bazel_gwill\fconqaj6\external\go_puller_linux\file\downloaded" -directory C:/users/gwill/_bazel_gwill/fconqaj6/external/py3_image_base/image -os linux -os-version "" -os-features "" -architecture amd64 -variant "" -features "" -name gcr.io/distroless/python3@sha256:de110a5eb0edb950dc4653ae0288f530b8c2af77e44d9bebab117ed0b74d5426): %1 is not a valid Win32 application.
 (error: 193) (C:/users/gwill/_bazel_gwill/fconqaj6/external/go_puller_linux/file/downloaded -directory C:/users/gwill/_bazel_gwill/fconqaj6/external/py3_image_base/image -os linux -os-version  -os-features  -architecture amd64 -variant  -features  -name gcr.io/distroless/python3@sha256:de110a5eb0edb950dc4653ae0288f530b8c2af77e44d9bebab117ed0b74d5426)
ERROR: C:/users/gwill/desktop/cognancy/WORKSPACE:23:16: fetching container_pull rule //external:py3_image_base: Traceback (most recent call last):
        File "C:/users/gwill/_bazel_gwill/fconqaj6/external/io_bazel_rules_docker/container/pull.bzl", line 175, column 13, in _impl
                fail("Pull command failed: %s (%s)" % (result.stderr, " ".join([str(a) for a in args])))
Error in fail: Pull command failed: java.io.IOException: ERROR: src/main/native/windows/process.cc(202): CreateProcessW("C:\users\gwill\_bazel_gwill\fconqaj6\external\go_puller_linux\file\downloaded" -directory C:/users/gwill/_bazel_gwill/fconqaj6/external/py3_image_base/image -os linux -os-version "" -os-features "" -architecture amd64 -variant "" -features "" -name gcr.io/distroless/python3@sha256:de110a5eb0edb950dc4653ae0288f530b8c2af77e44d9bebab117ed0b74d5426): %1 is not a valid Win32 application.
 (error: 193) (C:/users/gwill/_bazel_gwill/fconqaj6/external/go_puller_linux/file/downloaded -directory C:/users/gwill/_bazel_gwill/fconqaj6/external/py3_image_base/image -os linux -os-version  -os-features  -architecture amd64 -variant  -features  -name gcr.io/distroless/python3@sha256:de110a5eb0edb950dc4653ae0288f530b8c2af77e44d9bebab117ed0b74d5426)
ERROR: C:/users/gwill/desktop/cognancy/src/cognancy/BUILD.bazel:3:10: //src/cognancy:hello_world_image depends on @py3_image_base//image:image in repository @py3_image_base which failed to fetch. no such package '@py3_image_base//image': Pull command failed: java.io.IOException: ERROR: src/main/native/windows/process.cc(202): CreateProcessW("C:\users\gwill\_bazel_gwill\fconqaj6\external\go_puller_linux\file\downloaded" -directory C:/users/gwill/_bazel_gwill/fconqaj6/external/py3_image_base/image -os linux -os-version "" -os-features "" -architecture amd64 -variant "" -features "" -name gcr.io/distroless/python3@sha256:de110a5eb0edb950dc4653ae0288f530b8c2af77e44d9bebab117ed0b74d5426): %1 is not a valid Win32 application.
 (error: 193) (C:/users/gwill/_bazel_gwill/fconqaj6/external/go_puller_linux/file/downloaded -directory C:/users/gwill/_bazel_gwill/fconqaj6/external/py3_image_base/image -os linux -os-version  -os-features  -architecture amd64 -variant  -features  -name gcr.io/distroless/python3@sha256:de110a5eb0edb950dc4653ae0288f530b8c2af77e44d9bebab117ed0b74d5426)
ERROR: Analysis of target '//src/cognancy:hello_world_image' failed; build aborted: Analysis failed
INFO: Elapsed time: 0.327s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 193 targets configured)

🌍 Your Environment

Operating System:

  
Windows 10
  

Output of bazel version:

  
bazel 6.0.0-pre.20211101.2
  

Rules_docker version:

  
rules_docker-0.14.1
  

GeorgeWillaman avatar Nov 15 '21 12:11 GeorgeWillaman

Figured out a workaround solution. Installed Ubuntu 20.04 on WSL and am just prefixing commands with that (ie wsl bazel run src/cognancy:hello_world_image)

Working as expecting so far. Still curious why I was initially getting that error on my local machine

GeorgeWillaman avatar Nov 16 '21 00:11 GeorgeWillaman

This seems to be a windows compatibility issue due to a custom docker image pull script using an OS specific binary. The script is trying to run:

"C:\tmp\tyvlxemg\external\go_puller_linux_amd64\file\downloaded" -directory C:/tmp/tyvlxemg/external/golang_base/image -os linux -os-version "" -os-features "" -architecture amd64 -variant "" -features "" -name index.docker.io/library/golang:1.17

Unfortunately, the downloaded binary is compiled for the wrong OS.

This is also mentioned here: https://github.com/tensorflow/tensorflow/issues/37897

KyleWiering avatar Mar 10 '22 12:03 KyleWiering

This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_docker!

github-actions[bot] avatar Sep 07 '22 04:09 github-actions[bot]

This issue was automatically closed because it went 30 days without a reply since it was labeled "Can Close?"

github-actions[bot] avatar Oct 08 '22 03:10 github-actions[bot]