{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/6396","labels_url":"https://api.github.com/repos/docker/docker/issues/6396/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/6396/comments","events_url":"https://api.github.com/repos/docker/docker/issues/6396/events","html_url":"https://github.com/docker/docker/issues/6396","id":35640318,"number":6396,"title":"Forward ssh key agent into container","user":{"login":"phemmer","id":1826947,"avatar_url":"https://avatars.githubusercontent.com/u/1826947?v=3","gravatar_id":"","url":"https://api.github.com/users/phemmer","html_url":"https://github.com/phemmer","followers_url":"https://api.github.com/users/phemmer/followers","following_url":"https://api.github.com/users/phemmer/following{/other_user}","gists_url":"https://api.github.com/users/phemmer/gists{/gist_id}","starred_url":"https://api.github.com/users/phemmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phemmer/subscriptions","organizations_url":"https://api.github.com/users/phemmer/orgs","repos_url":"https://api.github.com/users/phemmer/repos","events_url":"https://api.github.com/users/phemmer/events{/privacy}","received_events_url":"https://api.github.com/users/phemmer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":31,"created_at":"2014-06-13T02:33:59Z","updated_at":"2015-02-21T22:29:50Z","closed_at":null,"body":"It would be nice to be able to forward an ssh key agent into a container during a `run` or `build`.\r\nFrequently we need to build source code which exists in a private repository where access is controlled by ssh key.\r\n\r\nAdding the key file into the container is a bad idea as:\r\n1. You've just lost control of your ssh key\r\n2. Your key might need to be unlocked via passphrase\r\n3. Your key might not be in a file at all, and only accessible through the key agent.\r\n\r\nYou could do something like:\r\n\r\n    # docker run -t -i -v \"$SSH_AUTH_SOCK:/tmp/ssh_auth_sock\" -e \"SSH_AUTH_SOCK=/tmp/ssh_auth_sock\" fedora ssh-add -l\r\n    2048 82:58:b6:82:c8:89:da:45:ea:9a:1a:13:9c:c3:f9:52 phemmer@whistler (RSA)\r\n\r\nBut:\r\n1. This only works for `docker run`, not `build`.\r\n2. This only works if the docker daemon is running on the same host as the client.\r\n\r\n&nbsp;\r\n\r\nThe ideal solution is to have the client forward the key agent socket just like `ssh` can.\r\nHowever the difficulty in this is that it would require the remote API build and attach calls to support proxying an arbitrary number of socket streams. Just doing a single 2-way stream wouldn't be sufficient as the ssh key agent is a unix domain socket, and it can have multiple simultaneous connections."},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/75396630","html_url":"https://github.com/docker/docker/issues/6396#issuecomment-75396630","issue_url":"https://api.github.com/repos/docker/docker/issues/6396","id":75396630,"user":{"login":"howdoicomputer","id":6774447,"avatar_url":"https://avatars.githubusercontent.com/u/6774447?v=3","gravatar_id":"","url":"https://api.github.com/users/howdoicomputer","html_url":"https://github.com/howdoicomputer","followers_url":"https://api.github.com/users/howdoicomputer/followers","following_url":"https://api.github.com/users/howdoicomputer/following{/other_user}","gists_url":"https://api.github.com/users/howdoicomputer/gists{/gist_id}","starred_url":"https://api.github.com/users/howdoicomputer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/howdoicomputer/subscriptions","organizations_url":"https://api.github.com/users/howdoicomputer/orgs","repos_url":"https://api.github.com/users/howdoicomputer/repos","events_url":"https://api.github.com/users/howdoicomputer/events{/privacy}","received_events_url":"https://api.github.com/users/howdoicomputer/received_events","type":"User","site_admin":false},"created_at":"2015-02-21T22:29:50Z","updated_at":"2015-02-21T22:29:50Z","body":"+1 I'm interested in building disposable dev environments using Docker but I can't quite get it working. This would help a lot in that regard."}}