docker-ssh-exec icon indicating copy to clipboard operation
docker-ssh-exec copied to clipboard

Using ENV var instructions in Readme Leads to invalid key

Open byoung opened this issue 5 years ago • 1 comments

Spinning up a key server while following the ENV var setup instructions will lead to an invalid key.

Running this to startup the key server

docker run -e DOCKER-SSH-KEY="$(cat ~/.ssh/id_rsa)" --name=keyserver -d mdsol/docker-ssh-exec -server

Then running any build command with a Dockerfile that contains a git clone of a private repo:

RUN docker-ssh-exec git clone -q 'ssh://[email protected]/mdsol/belker-python.git'

Will lead to this error

Step 9/21 : RUN docker-ssh-exec git clone -q 'ssh://[email protected]/mdsol/belker-python.git'
 ---> Running in d35e5372139e
Broadcasting UDP key request...
Got key from server.
Broadcasting UDP env request...
Recieved env from server
Setting 0 ENV vars from server: 
Writing key to /root/.ssh/id_rsa
Running command: git clone -q ssh://[email protected]/mdsol/belker-python.git
Warning: Permanently added the RSA host key for IP address '140.82.114.4' to the list of known hosts.
Load key "/root/.ssh/id_rsa": invalid format
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Using the first (non ENV var) method to spin up the container does work.

byoung avatar Oct 22 '20 14:10 byoung

Only difference in the key between the two methods was that the env var approach stripped the trailing newline.

byoung avatar Oct 22 '20 14:10 byoung