Live data from Hacker News

Just say no to :latest

platformers.dev

41–50 of 135 posts

Re: Just say no to :latest

#41
Eh. It depends. There are exceptions to every rule.

latest is useful for builds where you want to know when something will break. If you only stick to pinned versions, it's common for nobody to ever update the pinned versions for years. Then you're way behind the latest versions and suddenly upgrading becomes a huge pain. You may be stuck in a situation where you're forced to upgrade because of a security hole in your pinned version, but to upgrade to a patched version breaks everything.

".....But that's terrible!", you say. "My build won't be repeatable! I won't be able to perform a roll-back build! My build will constantly break!"

All of that is true, but there are workarounds. For example, if you download, version, and store all artifacts used for each build, you can reuse them later. This isn't hard if you take the time to write some scripts. You can pull a container and export it to a tarball and store it. System packages and language dependencies can be downloaded similarly, and repos mirrored. You can do this once a week and version all artifacts with a datestamp, and make your own app builds pinned to a particular datestamp.

If you always build from those versioned archived datestamps, you can always rebuild or revert to an old working latest build.

As far as builds breaking, they certainly will! You need good testing to catch bugs and regressions. But would you rather learn to adapt quickly to broken builds, or have a sleeping tiger waiting to bite you the one time you finally have to upgrade quickly?

Using a stable branch/tag is the safest hedge against frequently breaking builds while still getting security patches. But stable branches still introduce problems. You will eventually need to revert a stable change, and eventually the stable branch will be End Of Life. So even if you use stable, you should still use the practice of installing from downloaded versioned artifacts.

Since EOL will come eventually, you also have to commit to upgrading to a new stable branch and its breaking changes. You must therefore plan to sunset your own code. Find out when your dependencies will EOL, and plan to completely rebuild your apps using latest before then. It has to be a real commitment and not just a "nice to have", because you will end up being forced to do it by a security vuln or repos that stop carrying an old branch.

Ultimately you need to decide how much risk to take and how much planning is needed to avoid sticky situations. Be aware of the consequences of your design and have contingency plans.

Re: Just say no to :latest

#42
post #35

Forget for a second the security concerns - If you lose :latest, and the build breaks, you need to spend unexpected time fixing the build, for whatever reason that :latest broke it, in order to continue with the business objective that you were actually tasked to do. Essentially, you have InfoSec muscling in and demanding, by the most coercive way possible, that Thou Shalt Not Do Your Job Without Bowing Before Me. Wh…

> you have InfoSec muscling in and demanding, by the most coercive way possible, that Thou Shalt Not Do Your Job Without Bowing Before Me.

InfoSec is not optional.

Re: Just say no to :latest

#43
People are mentioning that pinning versions lead to overhead in updates. These people have probably not used Renovate https://docs.renovatebot.com/

Renovate is smart enough to understand that a task such as “Update Node to v16” means updating .nvmrc files, updating FROM in Dockerfiles and engines in package.json in a single PR it creates for you.

Re: Just say no to :latest

#44
Terrible advice.

It doesn't solve the "immutability" problem and may give you a false sense that it does, which is a much bigger problem.

Here's the "good" example from the article:

    # GOOD:
    image: "nginx:1.21.6"
Here is the header of the source of the Dockerfile for this image:

    FROM debian:bullseye-slim

    LABEL maintainer="NGINX Docker Maintainers "

    ENV NGINX_VERSION   1.21.6
    ENV NJS_VERSION     0.7.2
    ENV PKG_RELEASE     1~bullseye
    ...
    ...
    ...
Notice the first line? `debian:bullseye-slim` is not "immutable". Should the `nginx:1.21.6` image auto-update when new `debian:bullseye-slim` is available? Or should it keep it what it was during the build time? I am not exactly sure how nginx does it but it would not be incorrect to do either (both address different issues and are completely valid depending on what you want to do).

If you are serious about using docker, you need a private registry and you need to make a tagging policy that is best for YOUR use-case.

Re: Just say no to :latest

#46
post #29

Earlier quoted context omitted.

In that case, it's better to just pin the major version of the container: FROM python:3 will work as long as Python3 doesn't make any backwards incompatible changes (note: Python3 occasionally deprecates then removes a feature that was part of the official API[0], so Python3 is not technically semver-correct). If, however, one wants automatic updates WITH reproducible builds, then a CI/CD pipeline that automatically…

This is very bad advice. Lots of nontrivial things aren't automatically compatible with the latest Python minor version. PyTorch for instance doesn't support Python 3.10 and it's been five months since the stable release (ten months since the first beta). For anything nontrivial, you almost always want to specify a minor Python version.

[deleted]

Re: Just say no to :latest

#47
post #29

Earlier quoted context omitted.

In that case, it's better to just pin the major version of the container: FROM python:3 will work as long as Python3 doesn't make any backwards incompatible changes (note: Python3 occasionally deprecates then removes a feature that was part of the official API[0], so Python3 is not technically semver-correct). If, however, one wants automatic updates WITH reproducible builds, then a CI/CD pipeline that automatically…

This is very bad advice. Lots of nontrivial things aren't automatically compatible with the latest Python minor version. PyTorch for instance doesn't support Python 3.10 and it's been five months since the stable release (ten months since the first beta). For anything nontrivial, you almost always want to specify a minor Python version.

Why is this bad advice?

The PyTorch scenario is an exception, not the rule, and the users of PyTorch should know not to use unsupported versions.

> For anything nontrivial, you almost always want to specify a minor Python version.

Depends on how you define "trivial".

Re: Just say no to :latest

#48
post #42
post #35

Forget for a second the security concerns - If you lose :latest, and the build breaks, you need to spend unexpected time fixing the build, for whatever reason that :latest broke it, in order to continue with the business objective that you were actually tasked to do. Essentially, you have InfoSec muscling in and demanding, by the most coercive way possible, that Thou Shalt Not Do Your Job Without Bowing Before Me. Wh…

> you have InfoSec muscling in and demanding, by the most coercive way possible, that Thou Shalt Not Do Your Job Without Bowing Before Me. InfoSec is not optional.

Of course it's not. But it's not King, either.

Re: Just say no to :latest

#49

This is always a balance. The moment you pin to a specific version you need to have a process in place to ensure you regularly upgrade to avoid introducing vulnerabilities in your production system. Throughout my career I have seen many cases where certain software still runs on ancient versions as the team originally maintaining it is no longer around (e.g. reorganisations or lay-offs). It is always hard to convince…

Right. Let's assume you're going to need to upgrade sooner or later - the longer you leave it, the harder it gets.

Best to upgrade and discover dependency issues during dev/staging, than try to fix many months worth of them when there's an active CVE on your live pinned version.

Re: Just say no to :latest

#50
post #3

Earlier quoted context omitted.

Sure version tags could also move, but by convention they do not. Unlike the latest tag, which by convention does move a lot.

By convention npm packages are not deleted or hijacked.

You do realize that NPM package versions already are immutable? Dunno since when though.

Deletion is possible within limits but it also is with Docker. All the hashes in the world won't bring back a deleted image.

Post reply on HN