Docker Secrets and SSH Forwarding in Docker 18.09

Back in November Tõnis Tiigi wrote about Docker Engine 18.09's support for BuildKit and passing through SSH agent sockets at build time.

This is a great way to allow your Docker builds to be simplified when accessing private repostiries.

One of the complexities when using Dockerfiles has always been accessing private resources. If you need to access some private repository or service there really wasn’t a very good solution to achieve that. You shouldn’t use environment variables or plainly remove the secret files after use because they would still remain in the metadata of the image. Some creative use cases leveraged multi-stage builds, but the user still needed to be very careful to make sure the final stage is clean from all secure values, and the secret files would be kept in the local build cache until it is pruned.

Tõnis Tiigi

There is an issue unfortunately, this appears to be unsupported in Docker macOS. You can follow the issue #410