logoalt Hacker News

cyberaxyesterday at 11:43 PM1 replyview on HN

I don't quite understand how it handles running binaries then. For example, I want to do `bash -c "ls -la /"`. How would it run this command? It needs to assemble the filesystem at this point in the build process.

I guess the answer for Bazel is "don't do this"? Docker handles cross-compilation by using emulators, btw.


Replies

paulddrapertoday at 2:13 AM

> “don’t do this”

Yes. The Bazel way use to produce binaries, files, directories, and then create an image “directly” from these.

Much as you would create a JAR or ZIP or DEB.

This is (1) fast (2) small and (3) more importantly reproducible. Bazel users want their builds to produce artifacts that are exactly the same, for a number of reasons. Size is also nice…do you really need ls and dozens of other executables in your containerized service?

Most Docker users don’t care about reproducibility. They’ll apt-get install and get one version today and another version tomorrow.

Good? Bad? That’s a value judgement. But Bazel users have fundamentally different objectives.

> emulators

Yeah emulators is the Docker solution for producing images of different architectures.

Since Bazel doesn’t run commands as a running container, it skips that consideration entirely.

show 1 reply