--You received this message because you are subscribed to the Google Groups "golang-nuts" group.To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
A statically compiled go binary should be able to run with only the linux kernel. If you construct a docker container that contains a single folder, with a single file (your binary) this should work.That is unless you are using things like a tmp dir, the procfs etc. In which case you need to add those things to your CHROOT or Docker Container.In fact when [Rocket](https://github.com/coreos/rocket) first launched this was how they did their demo. Build a small hello world program and stick it and only it in their container.
If you're looking for a truly minimalist OS, try CoreOS. It's design to be a complement to Docker.
$ go build -tags=netgo test_http.go
$ ldd test_http
linux-vdso.so.1 => (0x00007fffe2bfc000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f39c6611000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f39c624c000)
/lib64/ld-linux-x86-64.so.2 (0x00007f39c6852000)
It's unclear why you'd need any kind of userland _inside_ the container, besides any programs your Go binary explicitly calls. A static Go binary depends on nothing but the kernel, so your docker image (or other "minimal container") needs only contain one file in its filesystem: the static binary itself.
One of the things I've been thinking about as I work through some app design problems, is how to use Docker and Go in a very clean and (someday) very secure way.the OS that runs inside the Docker container, probably needs, in my case, to be very small, and I have looked athttps://medium.com/@kelseyhightower/optimizing-docker-images-for-static-binaries-b5696e26eb07 - BusyBoxPlan9,Minix,Ubuntu Linux{Open,Free,Net}BSDand a few of the other Go OSes that are planned/announced/languishing