210 points · by zdw · 4y ago · 93 comments
Nice thing about this strategy is that you can uniformly enforce dependencies, versions, etc
Unless you're talking about running it on Windows or Mac. In which case, don't do that. You don't want your developers developing on a different OS than your CI & deployment environment anyway.
Eh, this kinda depends on what tech you're using. We use node.js at work which has very good cross-platform support. And we've had literally zero issues developing on mac and deploying to Linux in the 3 years I've been here.
You can very successfully write code that runs on Linux on either MacOS or Windows, depending on what you're developing.
Probably not a big deal, but just seems pointlessly narrow to think all developers would or should prefer actually developing on Linux exclusively.
Once the docker image is pulled into cache, a runc process is started, that process is placed into a specific cgroup and given various isolated namespaces, any volumes are mounted into the file system namespace, any special network mappings are created, and otherwise, yes running within Docker is as fast as running natively.
Who's running OS X servers in production?
What are the devs running OS X and IntelliJ tools deploying on?
We do both containerized and native for developing one service, but generally docker compose for the composition (vs say k8s or all native). And important that CI is in docker: that means we can do accurate local docker testing of same env in case of CI fails.
It depends what you're working on, but for a classic server backend in a high-level language, I don't find it a problem. It's very rare to hit an OS-specific problem, and it shows up in CI so the dev can correct it before code review.
Is there something obvious I may be doing wrong or some resources I should read about this?
It’s been a major issue for me. It seems to happen regardless of whether I’m using Docker Volumes or not.
When I started using Docker four years ago that was my biggest issue. When builds fail, I can't just pick up where it left to expect the environment and try stuff out (unless I purposely build an image with a ton of layers).
Soooo much time was wasted figuring out what was going on.
[0] https://www.gnu.org/software/make/manual/html_node/Choosing-...
[1] https://www.redhat.com/sysadmin/podman-inside-kubernetes
Don’t get me wrong, make is great, but I think it only really shines when you’re using a language like C/C++ where you can use it’s awesome dependency graphs. For projects in Go or JavaScript it quickly becomes a task runner with a very inconvenient syntax.
Earthly gives you a make-esque syntax while doing all of the work in Docker which gives you repeatability and parallelization for free.
Podman seems like a simpler container management tool for things that are merely wrapping/emulating traditional command line tools.
We use docker in this way for work, and it’s merely okay. We use docker to bundle the environment (which changes rarely) separate from the code and build system (which changes often). For this, docker has been great for 95% of all our internal users: way more than a makefile helped, but the remaining 5% were a huge pain. The most recent issue was the in-docker user having a different id from the local user, which isn’t a problem on macOS but is on Ubuntu.
At the point where docker made sense as a compatibility layer, it was trivial to convert the whole system into a service running on Kubernetes.
Probably the mount id mapping added in the linux kernel can be a way to resolve problem when user in docker and host have different id.
Although I don't know whether the system utils / docker command have integrated it or not yet.
[1]: https://github.com/kevin-hanselman/dud/blob/e98de8fcdf7ad564...
I tried `touch`ing hidden files for each step and then add those as a dependency but that is not very elegant. Do you have this problem at all?
Make is great and you'd likely use it inside the container. But everything around make is typically an enormous pain to manage across multiple machines, multiple architectures, etc. and that's where docker containers help greatly.
As a more expressive frontend of BuildKit, we created a simple, non-Turing-complete logic programming language, which can also be thought of as docker-based Makefile.
Guess so!
I use a multistage build to generate a podman/docker image that contains all my build artifacts and then just copy them out of the container onto my host system. What advantages would there be in using BuildKit for this sort of thing?
I use Docker for sort of a virtual network interface to allow me to connect to two VPNs (a VPN inside a VPN environment). Any good hardware/software finds all sorts of niches to fill in time.
I use the Tailscale extension to let my development pods talk to my tailnet. It's really handy (would be even better if it worked with the local Kubernetes cluster in Desktop). Of course you can do this yourself fairly easily, but it's nice to have it "managed" for a non-essential part of the workflow.
- Alternative docker frontends - https://matt-rickard.com/building-a-new-dockerfile-frontend/ (https://github.com/r2d4/mockerfile)
- Docker merge - https://matt-rickard.com/docker-merge/ (https://github.com/r2d4/docker-merge)
[0] https://docs.docker.com/build/buildx/#build-multi-platform-i...
It also supports running other architecture images using the same QEMU magic. It's really quite polished and works well.
Docker does provide environment variables you can use to automatically download the right file depending on the target architecture, but the syntax is very cumbersome.
That said, yes using something on the JVM is much more convenient, but that’s not possible if you’re not using a JVM language.
- cosign signatures, SBOMs, attestations: https://docs.sigstore.dev/cosign/overview/
- Istio wasm plugins: https://istio.io/latest/docs/reference/config/proxy_extensio...
- OPA bundles: https://www.openpolicyagent.org/docs/v0.13.5/bundles/
- Tekton bundles: https://github.com/tektoncd/resolution/tree/main/bundleresol...
There's even a demo (plug: in a talk I co-presented) of running a RISC-V emulator where its memory is stored in an OCI registry: https://www.youtube.com/watch?v=Xt_G-pUArTM
These all tend to include a CLI to collect/generate/validate resources and push/move/pull them, but the underlying implementation is roughly the same -- package content in a tarball, generate some JSON pointing to it, push that JSON to the registry (with auth).
The real benefit to this is that basically everyone has access to a registry these days -- in their cloud provider, on-prem, whatever -- with exactly the same APIs and mostly sane auth and client tooling.
If you're interested in exploring it for your use case let me know, I'd be happy to give you some pointers.
I forget what they were using it for, but it boiled down to packing up a json file or two in a tarball and pushing it to the local daemon with a special suffix. Then it could pull that and unpack it on the next run.