infra icon indicating copy to clipboard operation
infra copied to clipboard

Remove running Docker container in template build

Open dobrac opened this issue 8 months ago • 1 comments

Description

This PR removes Docker container run during the template build and replaces it with direct Firecracker run.

The process looks now:

  1. Get docker image from the remote repository
  2. Inject systemd OCI layer
  3. Inject new file layers with the required setup for hostname, dns, envd service configuration, basic provisioning script that is run before most of the VM services
  4. Start the FC VM and wait for Envd
  5. Run two additional commands:
    • configuration script (checks installed packages/or installs them, creates user, changes folder permissions, etc)
    • start command (if defined)
  6. Snapshot
  7. Upload template

This PR should also fix sometimes missing hostname from /etc/hosts as this is now completely in our scope and not docker container run.

Systemd

Because we are using systemd as init, it needs to be supplied before the first start of the FC. Because this is an operation, that is required for all images, it doesn't make much sense to spend time on each template build. For this reason, the systemd is prebuilt on Template Manager start and cached as a layer, which is then injected for each build.

User speed optimizations

If the user wants the build to be faster for iterations, they can preinstall the following packages in their Dockerfile openssh-server sudo socat chrony linuxptp. Their installation will be correctly detected by the configuration script and their installation will be skipped. This might help the post-processing time in some cases (down from around 1m to 25s in empty ubuntu:20.04), but it might increase the time spent on downloading the template.

Old Envd

This version doesn't include old (websockets) env version. Further removal will be done in future PR.

dobrac avatar May 14 '25 16:05 dobrac