TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Defence Against the Docker Arts

236 pointsby codefingerabout 6 years ago

19 comments

zapitaabout 6 years ago
Here’s a little known fact: “docker build” can trivially be extended to build buildpacks or CNB. Now that the buildkit refactoring is complete, Dockerfiles are just the default frontend. There’s already a buildpack frontend in the community repo, and it works great. Writing your own frontend is real straightforward.<p>Honestly after years of stagnation, the most exciting work on container building is now coming out of Docker. Buildkit is amazing, a real hidden gem.<p>See <a href="https:&#x2F;&#x2F;github.com&#x2F;moby&#x2F;buildkit" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;moby&#x2F;buildkit</a>
评论 #19568414 未加载
评论 #19567787 未加载
评论 #19569908 未加载
评论 #19566702 未加载
评论 #19567426 未加载
评论 #19568446 未加载
评论 #19567360 未加载
jrockwayabout 6 years ago
I&#x27;ve been very close to creating something like this internally. It is easy to write a Dockerfile that produces a compact and optimal container. But it&#x27;s the same lines of code over and over again. Anything we have that&#x27;s a static site looks like:<p><pre><code> FROM node:10 AS build WORKDIR &#x2F;foo COPY . . RUN npm i RUN npx webpack FROM nginx:whatever COPY nginx.conf &#x2F;etc&#x2F;nginx&#x2F;config.d&#x2F; COPY --from=build &#x2F;foo&#x2F;dist &#x2F;srv ... </code></pre> It&#x27;s fine when you have one. Annoying when you have a couple. This isn&#x27;t code that needs to be checked into the repository and updated. It needs to just work.<p>The other thing I&#x27;d like to see is the ability to output multiple containers from one Dockerfile. There is so much wasted work where I have webpack stuff and a go application that run in separate containers but are built together. There is one Dockerfile like the above to build the static part. There is another to build the go binary and copy it to an almost-pristine alpine container (including dumb-init, cacerts, tzdata, and grpc_health_probe). I don&#x27;t understand why I have to have two Docker files to do that.
评论 #19566007 未加载
m463about 6 years ago
I&#x27;m a novice docker user, but I found Dockerfiles to be probably the most direct, graspable, important part of docker.<p>It&#x27;s one readable text file used to recreate an entire environment. It&#x27;s sort of a picture worth a thousand command lines.<p>That said, I wish there was a way to get rid of all the &amp;&amp; stuff, which is used to avoild writing a layer of the filesytem.<p>Why not have something like:<p><pre><code> RUN foo RUN bar RUN bletch LAYER</code></pre>
评论 #19568599 未加载
评论 #19568505 未加载
choegerabout 6 years ago
You are setting up an entire operating system to install a single Microservice and just now noticed that you have redundancies?<p>You could have the same issue by simply trying to rpmbuild your app. No really, you are just doing packaging. If you want more comfort, look into how redhat or Debian maintain their packages. They have similar problems and most likely they have mature solutions.
评论 #19567069 未加载
评论 #19567366 未加载
评论 #19567264 未加载
jtwalesonabout 6 years ago
I&#x27;ve always felt that buildpacks in Heroku &#x2F; Cloud Foundry are the way to go as they offer a higher level of abstraction than Docker files. The resulting containers are often production ready with good default settings. In docker you are re-inventing the wheel more often than not.
评论 #19566807 未加载
评论 #19566561 未加载
Perceptesabout 6 years ago
I wish this had gone into some more technical detail about what &quot;CNB&quot; does that is actually better. Most of the article was just rehashing some problems with Dockerfiles, but the conclusion is just &quot;CNB fixes it!&quot; The one specific improvement they mention is being able to &quot;rebase&quot; an image without rebuilding the whole thing, which certainly sounds interesting, but is not explained. How does it work? What else is CNB other than a wrapper around `docker build`?
评论 #19568457 未加载
评论 #19568464 未加载
评论 #19567620 未加载
kevinsimperabout 6 years ago
I like they way they highlight that combining Ruby and nodejs makes for a complicated Dockerfile, while their example after only includes Ruby and not nodejs. And do they propose a buildpack called ruby-nodejs, because in many cases you don&#x27;t need nodejs in your Ruby app. OMG now buildpack&#x27;s are a leaky abstraction!
评论 #19568810 未加载
评论 #19567348 未加载
评论 #19568500 未加载
benbristowabout 6 years ago
I love the fact Heroku have open-sourced their buildpacks. Dokku takes great use of these and provides a very similar platform to themselves that you can host yourself (DigitalOcean even provide a base-image that will pre-configure Dokku for you). Great for personal websites and the like.<p>If you want to scale in a pinch then it&#x27;s a case of making some tiny tweaks and pushing to Heroku instead.
评论 #19567948 未加载
评论 #19566171 未加载
markbnjabout 6 years ago
It&#x27;s nice that they&#x27;ve built a tool that understands specific application contexts and can do the right things to build an efficient image. But imo that does not make the dockerfile a leaky abstraction.
wmfabout 6 years ago
I just saw a submission on the &quot;demise&quot; of Cloud Foundry (a Heroku-like PaaS) that&#x27;s relevant to this discussion: <a href="https:&#x2F;&#x2F;medium.com&#x2F;@krishnan&#x2F;lessons-from-the-demise-of-cloudfoundry-ed4f77a08a73" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;@krishnan&#x2F;lessons-from-the-demise-of-clou...</a><p><i>Opinionated Platforms Are Risky: The CloudFoundry platform was more opinionated than some competing platforms in the market. In fact, the biggest debate between CloudFoundry and its direct competitors was about whether customers need opinionated platforms or not. CloudFoundry only supported 12 factor applications whereas platforms built on top of Kubernetes could support both stateful and stateless (12 factor) applications.</i><p>If you&#x27;re building a stateless 12-factor app <i>and</i> there&#x27;s a buildpack that does what you want, buildpacks are clearly better than lower-level Dockerfiles. But there&#x27;s no buildpack for something like a database and there probably never will be, so the flexibility of directly building containers needs to exist.
评论 #19568312 未加载
评论 #19568473 未加载
评论 #19568886 未加载
bryanrasmussenabout 6 years ago
It took me a while to get the pun, it doesn&#x27;t show up in the article anywhere from what I could fine and I don&#x27;t actually see how you&#x27;re defending against anything here so I wonder - Did you just have this pun sitting around and were itching to use it somewhere, anywhere?
评论 #19570339 未加载
yRetsyMabout 6 years ago
Gitlab would benefit from this in the context of their autodevops featureset
评论 #19569672 未加载
评论 #19567699 未加载
评论 #19567996 未加载
amaiabout 6 years ago
So instead of a Dockerfile we now need a builder.toml file. In addition you need a detect and build script: <a href="https:&#x2F;&#x2F;buildpacks.io&#x2F;docs&#x2F;create-buildpack&#x2F;building-blocks-cnb&#x2F;" rel="nofollow">https:&#x2F;&#x2F;buildpacks.io&#x2F;docs&#x2F;create-buildpack&#x2F;building-blocks-...</a> Is this really a simplification?
评论 #19570544 未加载
caust1cabout 6 years ago
It&#x27;s not a case of buildpacks vs dockerfiles. They both solve different problems with different solutions.<p>Buildpacks fit nicely into the heroku way of doing things. But at any medium to large sized engineering organization, there&#x27;s no way they could satisfy the requirements for even a simple majority of services that using a Dockerfile provides.
评论 #19568484 未加载
onefuncmanabout 6 years ago
This seems written from an outdated perspective of Dockerfiles -- multi-stage builds landed in Docker 17.05 which are almost a year old and address most of the concerns in the article...
评论 #19570615 未加载
pugworthyabout 6 years ago
Vote me down, but oh god that title...
评论 #19565953 未加载
评论 #19570131 未加载
评论 #19566198 未加载
评论 #19566698 未加载
Polyisopreneabout 6 years ago
”Mixing operational concerns with application concerns like this results in a poor tool for developers who just want to write code and ship it as painlessly as possible.”<p>Yeah, throw that code over to the ops team. Let them figure stuff out themselves.
评论 #19571775 未加载
评论 #19566782 未加载
mychaelabout 6 years ago
&gt; creating Cloud Native Buildpacks (CNB), a standard for turning source code into Docker images without the need for Dockerfile<p>This is a solution in search of a problem. Please stop.
评论 #19568675 未加载
评论 #19568641 未加载
npstrabout 6 years ago
Lol no. Heroku is way too much magic for my taste.