12

I have a fairly simple Dockerfile and now would like to build a docker image using rules_docker. Trying to use container_image, it seems like I cannot use the Dockerfile as input. Is there any way to build with a Dockerfile?

Jin
  • 12,748
  • 3
  • 36
  • 41
abergmeier
  • 13,224
  • 13
  • 64
  • 120

2 Answers2

5

Update: There is now a rule called dockerfile_image. Read here for more details: https://github.com/bazelbuild/rules_docker/blob/master/contrib/dockerfile_build.bzl#L15

Luke Gehorsam
  • 340
  • 4
  • 16
2

I think it's by design not allowed due to non-hermetic nature of Dockerfile. We can RUN any command in Dockerfile, including the ones non-hermetic (can't always been reproduced)

Further discussion here:

Pahlevi Fikri Auliya
  • 4,157
  • 8
  • 35
  • 71