Skip to content

Instantly share code, notes, and snippets.

@soanvig
Created June 20, 2026 20:09
Show Gist options
  • Select an option

  • Save soanvig/f7b06b77a5ce40b57c824ae55064c049 to your computer and use it in GitHub Desktop.

Select an option

Save soanvig/f7b06b77a5ce40b57c824ae55064c049 to your computer and use it in GitHub Desktop.
SSH access in Dockerfile (private build dependencies)
# Example of using github.com for cargo with private dependency linked through SSH
# Run with: `docker build --ssh default=$SSH_AUTH_SOCK .`
RUN --mount=type=ssh \
mkdir -p /root/.ssh && ssh-keyscan github.com >> /root/.ssh/known_hosts \
&& cargo build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment