Last active
February 13, 2020 17:40
-
-
Save ciiqr/dc45f6a7188fed7abc5666c90c91bdcd to your computer and use it in GitHub Desktop.
docker build with ssh agent
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DOCKER_BUILDKIT=1 docker build --ssh default -t test-build-ssh . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # syntax=docker/dockerfile:1.0-experimental | |
| FROM ubuntu | |
| RUN apt update && apt install -y openssh-client | |
| RUN --mount=type=ssh ssh-add -l > /tmp/ssh-working-agent.out |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # if you need ssh-agent when running also (only on docker for mac) | |
| # source: https://docs.docker.com/docker-for-mac/osxfs/#ssh-agent-forwarding | |
| docker run --mount "type=bind,src=$SSH_AUTH_SOCK,target=/run/host-services/ssh-auth.sock" -e SSH_AUTH_SOCK="/run/host-services/ssh-auth.sock" -it test-build-ssh bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment