Skip to content

Port Image Builder container image from Alpine to distroless Azure Linux #1060

Open

Description

@mthalman

This would help to validate the benefits of distroless, and Mariner in general (a good dogfooding effort).

Originally, this was thought to have been blocked by not having a docker package in Mariner but I've now realized what we need is the moby-cli package. This allows us to run docker commands targeting the docker daemon on the host machine, connected by the docker socket.

My initial investigation into this has revealed a lot of changes necessary for this.

Tasks to complete:

  • Update Image Builder container image to Azure Linux #1392
  • Remove dependency on git CLI
    Currently Image Builder has a dependency on git for a single operation: to get the commit SHA of a file. Removing the dependency on the git CLI is useful because of the image size impact of including the git package in the image. It adds ~230 MB. The dependency on the git CLI can be replaced with equivalent logic that makes use of the libgit2sharp library which is already used.
  • Refactor pipeline to not rely on volume mounted artifacts directory
    As a result of running the container as a non-root user, that user does not have permission to write to the artifacts directory that gets volume mounted into the container. This is a bit of tricky problem to solve that would add complexity to the system. Instead, it can be mitigated by removing the volume mount altogether. The use of volume mounting was only done as a convenience to get files out of the container, not to send files in. So the pipeline can be updated to just use docker cp to get those artifact files out of the container.
  • Update Image Builder Dockerfile to be based on distroless Mariner

Related work:

Activity

  1. moved this to Backlog in .NET Dockeron Sep 23, 2022
  2. moved this from Backlog to On Deck in .NET Dockeron Sep 28, 2022
  3. added this to the .NET 8 milestone on Oct 19, 2022
  4. moved this from On Deck to Backlog in .NET Dockeron Oct 19, 2022
  5. lbussell commented on Sep 26, 2023

    @lbussell
    Member

    We should also update the Docker TestRunner to be based on Mariner as well.

  6. modified the milestones: .NET 8, .NET 9 on Jan 20, 2024
  7. moved this from Backlog to Current Release in .NET Dockeron Jan 20, 2024
  8. removed this from the .NET 9 Features milestone on Jan 23, 2024
  9. changed the title [-]Port Image Builder container image from Alpine to distroless Mariner[/-] [+]Port Image Builder container image from Alpine to distroless Azure Linux[/+] on Aug 12, 2024
  10. moved this from Current Release to Backlog in .NET Dockeron Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions