Publishing a New Container Image
About the Container Image
Firecracker uses a Docker container to standardize the build process. This also fixes the build tools and dependencies to specific versions. Every once in a while, something needs to be updated. To do this, a new container image needs to be built locally, then published to the AWS ECR registry. The Firecracker CI suite must also be updated to use the new image.
Prerequisites
Access to the
fcuvmECR repository.The
dockerpackage installed locally. You should already have this if you've ever built Firecracker from source.Access to both an
x86_64andaarch64machines to build the container images.
Steps
x86_64
Login to the Docker organization in a shell. Make sure that your account has access to the repository:
Navigate to the Firecracker directory. Verify that you have the latest container image locally.
Make your necessary changes, if any, to the Dockerfile(s). There's one for each supported architecture in the Firecracker source tree.
Commit the changes, if any.
Build a new container image with the updated Dockerfile.
a: Additionally also checks for any outdated python packages and tries to update them. This makes sure that python packages versions are up to date with latest versions.
b: Builds a container image but skips performing updates of python packages. The container image will use the locked versions of python packages.
Verify that the new image exists.
Tag the new image with the next available version and the architecture you're on.
Push the image.
aarch64
Login to the aarch64 build machine.
Steps 1-4 are identical across architectures, change x86_64 to aarch64.
Then continue with the above steps:
Build a new container image with the updated Dockerfile.
Verify that the new image exists.
Tag the new image with the next available version and the architecture you're on.
Push the image.
Create a manifest to point the latest container version to each specialized image, per architecture.
Update the image tag in the
devtoolscript. Commit and push the change.
Troubleshooting
Check out the rust-vmm-container readme for additional troubleshooting steps and guidelines.
I can't push the manifest
See this article for explanations and fix.
How to test the image after pushing it to the Docker registry
Either fetch and run it locally on another machine than the one you used to build it, or clean up any artifacts from the build machine and fetch.
I don't have access to the AWS ECR registry
Only a Firecracker maintainer can update the container image. If you are one, ask a member of the team to add you to the AWS ECR repository and retry.
I pushed the wrong tag
Tags can be deleted from the AWS ECR interface.
Also, pushing the same tag twice will overwrite the initial content.
I did everything right and nothing works anymore
If you see unrelated Python errors, it's likely because the dev container pulls Python 3 at build time. Python 3 means different minor versions on different platforms, and is not backwards compatible. So it's entirely possible that docker build has pulled in unwanted Python dependencies.
To include only your changes, an alternative to the method described above is to make the changes inside the container, instead of in the Dockerfile.
Let's say you want to update cargo-audit (random example).
Enter the container as
root.Make the changes locally. Do not exit the container.
Find your running container.
Commit the modified container to a new image. Use the
container ID.Repeat for
aarch64.Create and push the manifest.