根据 bazelbuild/rules_docker 上的文档,应该可以在 OSX 上使用这些容器映像,并且它还声称可以在没有 docker 的情况下这样做。
These rules do not require / use Docker for pulling, building, or pushing images. This means:
They can be used to develop Docker containers on Windows / OSX without boot2docker or docker-machine installed.
They do not require root access on your workstation.
Run Code Online (Sandbox Code Playgroud)
我怎么做?这是一个简单的规则:
go_image(
name = "helloworld_image",
importpath = "github.com/nictuku/helloworld",
library = ":go_default_library",
visibility = ["//visibility:public"],
)
Run Code Online (Sandbox Code Playgroud)
我可以建立与图像bazel build :helloworld_image。它会在 blaze-bin 中生成一个焦油球,但不会运行它:
INFO: Running command line: bazel-bin/helloworld_image
Loaded image …Run Code Online (Sandbox Code Playgroud) bazel ×1