Giter VIP home page Giter VIP logo

ensody / ssh-agent-inject Goto Github PK

View Code? Open in Web Editor NEW
23.0 2.0 3.0 39 KB

[Note: Not needed with VS Code anymore.] Forwards the host's ssh-agent into a Docker container on Windows and macOS hosts.

License: MIT License

Dockerfile 2.50% Shell 18.38% Go 79.13%
docker ssh ssh-key ssh-agent ssh-agent-forwarding windows openssh-client macos osx linux cross-platform vscode vscode-remote docker-container

ssh-agent-inject's Issues

Permission Denied when running as non root

Typically my dev containers run as a non-root user in VSCode and when trying to interact with the agent, I get Permission Denied.
Both ssh-add -l and simply using ssh get permission denied when interacting with the agent. The /tmp/.ssh-auth-sock permissions are srwxr-xr-x root:rooot. If I run the same container as root with:

docker run -ti --rm -e SSH_AUTH_SOCK=/tmp/.ssh-auth-sock -l com.ensody.ssh-agent-inject= --entrypoint=/bin/bash vsc-mw-docker-base-image-updater-integration-393441b99ce096875fdf31c15bd6ca7f-uid 

I can use the agent socket just fine.

Error connecting to agent from entrypoint

I have a Dockerfile with an entrypoint script that expects the agent to be forwarded. But it does not work in the entrypoint when I run the container. It works when I run the same afterwards from the shell.
docker run -it mydockerimage sh
Error connecting to agent: No such file or directory - thats from the entrypoint

But when the shell opens

# ssh-add -l
3072 SHA256:BLAHBLAHBLAH mylogin (RSA)
#

EDIT: Adding some sleep into the entrypoint helped. Would be nice if it somehow waited automatically if possible

BTW thanks a lot for this package

socket: too many open files

During a docker build which requires a RUN with --mount=type=ssh, I end up with the error below printed by ssh-agent-inject process.

Error fetching containers error during connect: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.25/containers/json?filters=%7B%22label%22%3A%7B%22com.ensody.ssh-agent-inject%22%3Atrue%7D%7D&limit=0: dial unix /var/run/docker.sock: socket: too many open files

Copy from agent to sock failed

I'm getting this error on macOS Mojave 10.14.6 when trying to install php composer dependencies from private repositories while building a docker image with ssh-agent-inject support.

173860a65acb7d82ba855ab25069a8fb890f6a0be9412bab63d5ca0bba087eb8 Copy from agent to sock failed: read unix ->/private/tmp/com.apple.launchd.FLrERP3sdn/Listeners: use of closed network connection

The same image builds properly on Ubuntu 18.04

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.