Skip to content
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

Fix qemu binfmt image is pulled during instance startup #1231

Merged

Conversation

triarius
Copy link
Contributor

@triarius triarius commented Oct 3, 2023

The intention was always for it to be pulled when the AMI is built, and just run when then instance is started, but it turns out the garbage collector was running before the docker setup script, so the image was being pulled on every instance start.

This PR fixes this by only enabling the timers after docker has been configured and the qemu binfmt image has run.

I've also added more comments around the mechanism by which the digest of the qemu binfmt image is passed from the packer build scripts to the startup script, as it was the source of some confusion. As well as more logging in general.

Closes: #1229

It should have been pulled when the AMI is built.
When you pull an image from a registry and specify both a tag and a digest,
docker does not seem to tag it locally. This leaves the image unable to
be run if both the tag and the digest are specified to `docker run`.
But it will run if only by the digest is specified.
@triarius triarius changed the base branch from main to pdp-1587-clearer-logs-in-buildkiteelastic-stack-log-group October 3, 2023 00:13
@triarius triarius marked this pull request as ready for review October 3, 2023 00:50
@triarius triarius requested a review from a team October 3, 2023 00:50
sudo mkdir -p /usr/local/lib
echo "QEMU_BINFMT_TAG=\"$QEMU_BINFMT_TAG\"" | sudo tee -a /usr/local/lib/bk-configure-docker.sh
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When images are pulled with a tag and digest, docker does not seem to keep the tag. Try it with

$ docker pull alpine:3.18.4@sha256:eece025e432126ce23f223450a0326fbebde39cdf496a85d8c016293fc851978
$ docker image ls
REPOSITORY                   TAG             IMAGE ID       CREATED         SIZE
alpine                       <none>          8ca4688f4f35   4 days ago      7.33MB

I don't think it affects docker run though 🤷‍♂️.

Copy link
Contributor

@moskyb moskyb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome work 🎉

Base automatically changed from pdp-1587-clearer-logs-in-buildkiteelastic-stack-log-group to main October 4, 2023 00:04
@triarius triarius merged commit 8c77ec4 into main Oct 4, 2023
1 check passed
@triarius triarius deleted the pdp-1788-fix-qemu-binfmt-image-is-pulled-during-elastic-ci-stack branch October 4, 2023 00:04
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.

None yet

2 participants