News for hackers. Stuff that matters.
Re:Inside Docker's “FROM scratch” by cdancette on Monday November 27, 2017 @05:12AM (#15786223)
Very interesting. Does someone have an example of a project where they used scratch? It seems to be only useful to build base distribution images
Re:Inside Docker's “FROM scratch” by kosinus on Monday November 27, 2017 @06:42AM (#15786619)
Static building, as mentioned by others, also works for Rust. Portier builds this way:

https://github.com/portier/portier-broker/blob/master/Docker...

This uses the awesome clux/muslrust Docker image as a build environment, then copies the result into a new ‘from scratch’ layer.

Re:Inside Docker's “FROM scratch” by ek5Jf on Monday November 27, 2017 @05:28AM (#15786299)
Yes.

Works great with Haskell statically compiled binaries. Running the binary through UPX i've managed to get small HTTP microservices down to a 2MB docker image with just Scratch.

Re:Inside Docker's “FROM scratch” by Intermernet on Monday November 27, 2017 @05:32AM (#15786314)
Works just as well for Go binaries. It's pretty much the recommended base image for distribution of Go apps on Docker. I assume that it would be just as effective for any statically compiled binary.

Edit: I really should have read the article first. It uses Go binaries as the example. Good to know Haskell folks are also using it.

Re:Inside Docker's “FROM scratch” by rmoriz on Monday November 27, 2017 @05:33AM (#15786323)
Massive downside: You run your app as root or you have to do nasty mounts of /etc/passwd and /etc/group from your host
Re:Inside Docker's “FROM scratch” by lizxrice on Monday November 27, 2017 @07:52AM (#15786894)
You don't have to mount the host versions - you can create container-specific ones.

See https://medium.com/@lizrice/non-privileged-containers-based-...

Re:Inside Docker's “FROM scratch” by Intermernet on Monday November 27, 2017 @05:44AM (#15786368)
You can run a Docker container as a particular user.

https://docs.docker.com/engine/reference/builder/#user

You can use `setcap` to grant capabilities to the binary or the `pam_cap` module if you need to do capabilities per user.

I haven't run across the need to run most containers as root for a while now.

Re:Inside Docker's “FROM scratch” by embano1 on Monday November 27, 2017 @07:03AM (#15786684)
Yup, in the end it´s an OS process and all rules apply. I did not care too much about Dockerfile best practices in my article. Good point, should at least have used "user <!root>".
Re:Inside Docker's “FROM scratch” by rkeene2 on Monday November 27, 2017 @10:49AM (#15788200)
I used FROM scratch to build a docker container for AppFS, which just has 2 files: init, and appfsd

http://appfs.rkeene.org/web/artifact/42acc0ed9e8f4327

init comes from: http://appfs.rkeene.org/web/artifact/ecb8eda1cfb32ecc

And just sets up some symlinks and starts appfsd, followed by running bash (which is cached and run transparently).

Re:Inside Docker's “FROM scratch” by embano1 on Monday November 27, 2017 @07:00AM (#15786670)
Thx! See me comment above on why you would want to put static binaries in "scratch", i.e. use "scratch" to deploy apps and not just for building base layers as you suggest.
Re:Inside Docker's “FROM scratch” by walterstucco on Monday November 27, 2017 @10:44AM (#15788153)
You can however compose micro services with scratch

For example I created a cntlm base image (linked in another comment)

From there I can do

FROM my_base_image COPY whatever

and then add layers of services

first one is proxy

second one could be queue service (for example http://nsq.io)

then a message server, that just sends notifications

etc. etc. etc.

The same could be achieved downloading and configuring the static binaries, but Docker packaging, security and network separation makes evrything a little bit easier

Re:Inside Docker's “FROM scratch” by buzzdenver on Monday November 27, 2017 @09:38AM (#15787618)
I have a sidecar pod in kubernetes that runs "kubectl proxy" so the image just has the kubectl binary.
Re:Inside Docker's “FROM scratch” by avip on Monday November 27, 2017 @07:38AM (#15786842)
I use it as base image for docker-compose.