codefresh-io / remote-docker

A Docker container to securely control a remote docker daemon CLI using ssh forwarding, no SSL setup needed.
Apache License 2.0
16 stars 12 forks source link

Avoiding to "Enter passphrase for key " each time #2

Open mwaaas opened 7 years ago

rmetcalf9 commented 5 years ago

I am not sure if I am having the same issue as mwaaas or not. The following command from my machine works: docker run --rm -e SSH_KEY="${SSH_KEY}" -e SSH_PORT=7452 codefresh/remote-docker rdocker codefreshrunner@metcarob.com docker ps

But the following codefresh yml freestyle step hangs when prompting for the pass prase:

  deploy_to_metcarob_swarm:
      image: codefresh/remote-docker
      working_directory: ${{main_clone}}
      commands:
        - rdocker ${{RDOCKER_HOST}} docker ps
      environment:
        - SSH_KEY=${{SSH_KEY}}
        - SSH_PORT=${{SSH_PORT}}

Output:

Running freestyle step: deploy_to_metcarob_swarm                                                                                                           
Pulling image codefresh/remote-docker:latest                                                                                                               
Digest: sha256:2efe2e82ee314ff9ca2c870525aece53366b830ddf979ae8aa463110dade0804                                                                            
Status: Image is up to date for codefresh/remote-docker:latest                                                                                             
SSH key passed through SSH_KEY environment variable: lenght check 3243                                                                                     
Warning: Permanently added '[metcarob.com]:7452,[78.31.105.225]:7452' (ECDSA) to the list of known hosts.                                                  
Enter passphrase for key '/root/.ssh/id_rdocker':      

As per https://codefresh.io/docs/docs/deploy-your-containers/docker-swarm/#deploy-to-docker-swarm-using-the-pipelines-ui-deploy-step%20deploy_to_metcarob_swarm I have removed all new lines from the SSH key and replaced with commas:

SSH_KEY=$(cat ~/.ssh/my_ssh_key_file | tr '\n' ',')

rmetcalf9 commented 5 years ago

I have also tried the following codefresh.yml but I get the same result:

  deploy_to_metcarob_swarm:
      image: codefresh/remote-docker
      working_directory: ${{main_clone}}
      commands:
        - export SSH_KEY=$(echo ${SSH_KEY_COMMAS} | tr ',' '\n')
        - rdocker ${{RDOCKER_HOST}} docker ps
      environment:
        - SSH_KEY_COMMAS=${{SSH_KEY}}
        - SSH_PORT=${{SSH_PORT}}