简体   繁体   English

使用 Bazel 从 Dockerfile 构建 docker 镜像

[英]Build docker image from Dockerfile using Bazel

I have a fairly simple Dockerfile and now would like to build a docker image using rules_docker .我有一个相当简单的Dockerfile ,现在想使用rules_docker构建一个docker 镜像 Trying to use container_image , it seems like I cannot use the Dockerfile as input.尝试使用container_image ,似乎我无法使用Dockerfile作为输入。 Is there any way to build with a Dockerfile ?有没有办法用Dockerfile构建?

Update: There is now a rule called dockerfile_image .更新:现在有一个名为dockerfile_image的规则。 Read here for more details: https://github.com/bazelbuild/rules_docker/blob/master/contrib/dockerfile_build.bzl#L15阅读此处了解更多详细信息: https : //github.com/bazelbuild/rules_docker/blob/master/contrib/dockerfile_build.bzl#L15

I think it's by design not allowed due to non-hermetic nature of Dockerfile .我认为这是设计不允许的,因为Dockerfile non-hermetic We can RUN any command in Dockerfile , including the ones non-hermetic (can't always been reproduced)我们可以在Dockerfile RUN任何命令,包括那些非密封的(不能总是被复制)

Further discussion here:进一步讨论在这里:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM