Live data from Hacker News

Gocker: Docker implemented in 1.3k lines of Go

unixism.net

31–40 of 89 posts

Re: Gocker: Docker implemented in 1.3k lines of Go

#31
post #24

Earlier quoted context omitted.

While I tend to agree, I think LoC can give a sense of scale for large systems and at least a tiny bit of insight about its potential complexity. I recently worked with a client on an integration effort that had to touch many different points on a (massive, for me) codebase with tens of millions of LoC. For that, LoC was the only reasonable metric I could come up with to try and convey the scale and complexity of the…

Hopefully you’ll forgive this potentially obvious question- is LoC (still?) generally accepted to be bounded ar 80 col?

In some circles yes. Linus recently weighed in against the 80 limit.

http://lkml.iu.edu/hypermail/linux/kernel/2005.3/08168.html

Re: Gocker: Docker implemented in 1.3k lines of Go

#32
post #25

Can someone explain the value/purpose of docker to someone who (easily) deploys regular apps to a Digital Ocean droplet?

Easily.

* A Docker image normally contains all the dependencies of a program, or a set of programs. You can run libraries and other software of whatever versions, not necessarily available on your host system; they are already baked into the image. Usually a Docker image only needs a compatible kernel (this is a very lax restriction). It is a damn easy way to distribute software, especially such software which is not trivial to install and set up: tired of wrangling with Grafana installation? just pick a container from their site. And of course you can mount whatever you need inside the container when you need to, so it has controlled access to your filesystem(s).

* A Docker image normally runs with its own firewall. That is, you explicitly say which IPs / ports are available ("exposed") from the container; everything else is blocked. This helps isolate containers from the internet and from one another, and also helps build private networks between containers not exposed outside the host machine. Since containers already talk to each other via a network, it becomes easy to distribute them across many machines when you need to scale.

* A Docker image is built out of layers, and they can share layers. If you are reasonable enough to put common stuff to the bottom layers, then you can have multiple containers with a lot of common software installed inside (like a Node runtime, a JVM, etc) which stored on the host system only once.

* Docker images / containers are the standard for many cloud management systems. AWS can run containers directly. K8s operates on containers. Docker itself offers a simple but rather reasonable orchestration tool called docker-compose. It's great for small deployments and for things like running your setup locally, for development and integration testing.

Containers are not always better for everything you can think of. But they solve a number of common problems; some of these problems might be ones you'd like to have solved, some not.

Re: Gocker: Docker implemented in 1.3k lines of Go

#33
post #25

Can someone explain the value/purpose of docker to someone who (easily) deploys regular apps to a Digital Ocean droplet?

The joke that I think actually explains it pretty well is that it eliminates the "well it works on _my_ machine" problem, by not just shipping the code, but shipping the machine.

It's also a great way to make sure your build artifacts are owned by root so you don't accidentally delete them.

Re: Gocker: Docker implemented in 1.3k lines of Go

#34

Very nice! I love projects like this that return to first principles, and rebuild the core without the cruft. It is refreshing. The dependency on netlink adds a little to the code weight. Some of this also feels like it could just be a shell script (sh, unlike Go, ships with built in Linux support for netlink, and sticks with dotted-quad-string types for IP addresses instead of mixing with int32!) I did not realize c…

TBH, all network utilities I ever saw accept the int32 form of IP addresses. E.g. ping 127.0.0.1 can also be written as

  ping 0x7f000001
Try it; it works.

Re: Gocker: Docker implemented in 1.3k lines of Go

#35
post #28
post #26

Earlier quoted context omitted.

Reproducibility is the biggest value in my opinion. A Dockerfile encapsulates all the messy dependencies in a single isolated environment. This also makes deployments easier too.

I would say that's portability rather than reproducibility. Docker increases the extent of, but doesn't guarantee, reproducibility.

In which case does it not guarantee reproducibility?

Re: Gocker: Docker implemented in 1.3k lines of Go

#38
post #34

Very nice! I love projects like this that return to first principles, and rebuild the core without the cruft. It is refreshing. The dependency on netlink adds a little to the code weight. Some of this also feels like it could just be a shell script (sh, unlike Go, ships with built in Linux support for netlink, and sticks with dotted-quad-string types for IP addresses instead of mixing with int32!) I did not realize c…

TBH, all network utilities I ever saw accept the int32 form of IP addresses. E.g. ping 127.0.0.1 can also be written as ping 0x7f000001 Try it; it works.

You can also just provide an integer. That works too.

Re: Gocker: Docker implemented in 1.3k lines of Go

#39
post #28

Earlier quoted context omitted.

I would say that's portability rather than reproducibility. Docker increases the extent of, but doesn't guarantee, reproducibility.

In which case does it not guarantee reproducibility?

I can answer this one. Sometimes you have lines like this:

    FROM ubuntu:focal
    RUN apt-get -y install libssl-dev
    
Since libssl-dev gets periodically updated (security updates and whatnot) if you build this now and build it again in 1 year you're very probably not going to get the same OpenSSL version. So it MIGHT be reproducible, but can easily give you different results depending on updates to the packages and the way your Dockerfile imports external dependencies. And that's before we even mention updates to the base container image.

Of course, you can refer to a specific container image id and pin all your packages, which would go a long way to improving reproducibility.

Re: Gocker: Docker implemented in 1.3k lines of Go

#40

Earlier quoted context omitted.

In which case does it not guarantee reproducibility?

I can answer this one. Sometimes you have lines like this: FROM ubuntu:focal RUN apt-get -y install libssl-dev Since libssl-dev gets periodically updated (security updates and whatnot) if you build this now and build it again in 1 year you're very probably not going to get the same OpenSSL version. So it MIGHT be reproducible, but can easily give you different results depending on updates to the packages and the way…

So it's wrong (or rather uninformed) usage of Docker that leads to this, the tech itself is sound and does guarantee reproducibility.
Post reply on HN