Skip to content

Dockerd wrapper housekeeping#4267

Merged
idelvall merged 2 commits intoearthly:eliottwiener-gridunity/dockerd-wrapper-housekeepingfrom
eliottwiener-gridunity:dockerd-wrapper-housekeeping
Aug 6, 2024
Merged

Dockerd wrapper housekeeping#4267
idelvall merged 2 commits intoearthly:eliottwiener-gridunity/dockerd-wrapper-housekeepingfrom
eliottwiener-gridunity:dockerd-wrapper-housekeeping

Conversation

@eliottwiener-gridunity
Copy link
Copy Markdown
Contributor

When using a self-hosted satellite with the --docker-cache experimental feature enabled, it was found that leftover bad state in the cached data-root could cause builds to start failing. In particular, a leftover, stopped container making use of one of the images that the dockerd-wrapper.sh attempts to rmi would result in a unable to remove repository reference error. Some additional debugging revealed that other types of docker objects are potentially left behind in the data-root. This change modifies the docker-wrapper.sh to do some housekeeping of these undesirable objects, and also makes changes to avoid having builds fail due to unanticipated leftover state.

Forcing the removal prevents 'unable to remove repository reference'
errors when the image is still being used by a container.

In this case, it is acceptable to remove the repository reference, and
continue script execution.
When using a cached data-root, it is possible that some undesired docker
objects have been left behind from a previous execution. In these cases,
we should remove the unnecessary docker objects prior to executing the
RUN.

This change assumes that the intention of the --docker-cache feature is
only to retain image layers between executions, and that it is not
intended to retain volumes, networks, or containers.
@eliottwiener-gridunity eliottwiener-gridunity requested a review from a team as a code owner August 1, 2024 20:02
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Aug 1, 2024

CLA assistant check
All committers have signed the CLA.

@idelvall idelvall changed the base branch from main to eliottwiener-gridunity/dockerd-wrapper-housekeeping August 6, 2024 08:48
@idelvall idelvall merged commit 453df49 into earthly:eliottwiener-gridunity/dockerd-wrapper-housekeeping Aug 6, 2024
idelvall added a commit that referenced this pull request Aug 6, 2024
When using a self-hosted satellite with the `--docker-cache`
experimental feature enabled, it was found that leftover bad state in
the cached data-root could cause builds to start failing. In particular,
a leftover, stopped container making use of one of the images that the
`dockerd-wrapper.sh` attempts to `rmi` would result in a `unable to
remove repository reference` error. Some additional debugging revealed
that other types of docker objects are potentially left behind in the
data-root. This change modifies the `docker-wrapper.sh` to do some
housekeeping of these undesirable objects, and also makes changes to
avoid having builds fail due to unanticipated leftover state.

Co-authored-by: eliottwiener-gridunity <134441321+eliottwiener-gridunity@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants