E

SSH Git Support Issue in Yocto Linux Containers

Summary

The user is building Yocto Linux within a container and is encountering an issue with SSH git support while following best practices against compiling as root. They have created a user named builder to perform the build process. However, the forwarded SSH authentication socket is owned by root, preventing the builder user from accessing it. While a standard Dockerfile allows for a workaround using RUN --mount=type=ssh,uid=<uid of builder>, this option is not available in Earthfile. The user is seeking a solution to this problem.

Status
open
Tags
  • Support Need
Source
#earthly
    n

    nilsson.e

    1/28/2025

    Hi, A while back I was asking questions surrounding SSH git support.

    I've now found another scenario which is tricky to get right with Earthly.

    I'm attempting to build Yocto Linux from within a container. Yocto explicitly wants you to not compile as root. So the dockerfile (Earthfile) sets up a user called builder that does the actual building.

    One of the steps of the build process is to fetch source code from a number of git repos using SSH. I use RUN --ssh of course but what happens is that the forwarded auth sock /run/buildkit/ssh_agent.0is owned by rootand cannot be accessed by builder. In Dockerfile using RUN --mount=type=ssh,uid=&lt;uid of builder&gt;would do the trick, but doesn't seem to be supported by Earthfile.

    Is there a way to get around this?