sincecutoff.com
← all changes

Dagger `Directory.dockerBuild` supports SSH mounts

Introduced 2026-02-05 · score 0.94

HOW TO USE IT

When a Dockerfile build step needs SSH authentication, pass an SSH socket to `Directory.dockerBuild`; its `RUN --mount=type=ssh` instruction can then use that socket.

func (m *MyModule) DoDockerbuild(dir *dagger.Directory, sshSock *dagger.Socket) *dagger.Container { return dir.DockerBuild(dagger.DirectoryDockerBuildOpts{SSH: sshSock}) } dag then call do-dockerbuild --dir . --ssh-sock "$SSH_AUTH_SOCK"

WHY THIS HELPS

Build a repository image with Dockerfile steps that need SSH access, such as fetching private dependencies.

REQUIREMENTS AND LIMITATIONS

  • Version: v0.19.11
  • ssh: Optional `Socket` for SSH authentication during the build; typically obtained from `SSH_AUTH_SOCK` with `host.unixSocket()`.
  • Prerequisite: Pass the socket explicitly as an API argument; the Dockerfile step uses it with `RUN --mount=type=ssh`.

FIRST-PARTY EVIDENCE

Check the installed version and the source before using it. Entry JSON

Report a problem with this card