4 ms·
My favorite Docker BuildKit feature is SSH agent forwarding. Add "--mount=type=ssh" after RUN commands in Dockerfiles and the command will use your host machine
by meowface 8y ago
My favorite Docker BuildKit feature is SSH agent forwarding. Add "--mount=type=ssh" after RUN commands in Dockerfiles and the command will use your host machine's SSH agent. I've been able to greatly simplify a lot of Dockerfiles and CI build processes using it.
There's a good introduction here: https://medium.com/@tonistiigi/build-secrets-and-ssh-forwarding-in-docker-18-09-ae8161d066 https://medium.com/@tonistiigi/build-secrets-and-ssh-forward...
- theptip 8y agoOh, that's nice -- that's been a pain point for a long time, and it seemed like there was a philosophical argument against making the Dockerfile's behaviour context-dependent like this.
- meowface 8y agoYou do have to pass an extra "--ssh default" argument to "docker build", so it's not totally automagical or anything.
- bsilvereagle 8y agoThis feature currently does not work with the OS X ssh agent: https://github.com/docker/for-mac/issues/410 https://github.com/docker/for-mac/issues/410
- auvrw 8y agossh access at build time via buildkit works on os x https://medium.com/@tonistiigi/build-secrets-and-ssh-forwarding-in-docker-18-09-ae8161d066 https://medium.com/@tonistiigi/build-secrets-and-ssh-forward... the link you've supplied regards ssh access when running docker images, not when building them. ... i did notice that for lots of downloads, it is somewhat slower, or perhaps more prone to lag, than authentication from inside the running image.