-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
makefiles/docker.inc.mk: always pull to keep image up-to-date #20470
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx for addressing this. Just a week ago the issue with an outdated container popped up in an issue, so this improves quality of life a lot.
Ah, two corner cases: What happens when sitting in a train in Brandenburg? (For the non-Germans: There is no Internet connectivity in Brandenburg.) What happens when a local docker image is passed to be used instead of the default one? |
As you can see, very good points! Should we have an environment/Makefile variable to explicitly disable pulling? |
# - set username/UID to executor | ||
DOCKER_USER ?= $$(id -u) | ||
DOCKER_USER_OPT = $(if $(_docker_is_podman),--userns keep-id,--user $(DOCKER_USER)) | ||
DOCKER_RUN_FLAGS ?= --rm --tty $(DOCKER_USER_OPT) | ||
DOCKER_RUN_FLAGS ?= --pull=always --rm --tty $(DOCKER_USER_OPT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DOCKER_RUN_FLAGS ?= --pull=always --rm --tty $(DOCKER_USER_OPT) | |
DOCKER_RUN_FLAGS ?= --pull=newer --rm --tty $(DOCKER_USER_OPT) |
With podman
this does the trick. It does take a bit of time to timeout the check in the Brandenburg case.
But maybe the best would be to just allow users to overwrite this via environment variable, e.g. by setting RIOT_DOCKER_PULL_POLICY
or whatever.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this flag is not available for docker: https://docs.docker.com/reference/cli/docker/container/run/#pull
I've tried adding it and it will just be silently ignored (i.e., the docker image is not updated).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we could have different defaults for docker (--pull=always
) and podman (--pull=newer
) and have DOCKER_SKIP_PULL
to disable pulling altogether?
Doesn't this touch the network every time, taking time and possibly failing when in trains? I would definitely want to disable this. |
I think it would make more sense to fix thix first in riotdocker by tagging & building semver releases, then pin a semver compatible release in the RIOT branch. and then, only pull if the current release is not semver-compatible. or, just bail out in that case, as it wouldn't happen too often. |
Agreed. But who is going to do that? This would fix problems people are having right now. (Two people reported issues caused by an outdated docker container just within the last 7 days, likely this is frequent.) And with the Let's go with the |
OK, since How about pinning the docker image instead to a list of known good versions: #20472 |
this is probably not the solution we want -> make this a little less green
Can this be a draft? |
Obsolete since #20472 has been merged. |
Contribution description
On current master,
BUILD_IN_DOCKER
might fail just because the local docker image is outdated. Since the image is automatically pulled upon the first build with docker, users (including me) probably would expect RIOT to keep the image updated automatically.This PR changes the
docker run --pull
argument from the defaultmissing
toalways
.Testing procedure
BUILD_IN_DOCKER=1 make -C examples/hello-world all
BUILD_IN_DOCKER=1 make -C examples/hello-world all
Issues/PRs references
Issue was discussed on matrix, where @maribu proposed to automatically pull on each build.