Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 08-29-2019, 12:06 PM   #1
Registered: Nov 2008
Posts: 111

Rep: Reputation: 24
Question Jenkins in docker ssh issue


I'm using MacOS.
Today I created docker container with Jenkins for pipeline testing purpose.
To make it working, I need ssh key access from jenkins container to my MacOS shell.
I simply go to container, generate ssh key, copy it to my Mac, and that should work.
Sadly it constantly asking me for password, even PubkeyAuthentication is enabled.

Any ideas what might be wrong?

mum@bb-l-m-gd-200 ~/projects/repo$ docker exec -ti jenkins /bin/bash
jenkins@46e0509ddfae:/$ hostname 
jenkins@46e0509ddfae:/$ ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/var/jenkins_home/.ssh/id_rsa): 
Created directory '/var/jenkins_home/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /var/jenkins_home/.ssh/id_rsa.
Your public key has been saved in /var/jenkins_home/.ssh/
The key fingerprint is:
SHA256:CwsvRfnMie4wfj2b/o705+XJrPpVykY39l/3CcLBn3g jenkins@46e0509ddfae
The key's randomart image is:
+---[RSA 2048]----+
|                 |
|       .         |
|      o          |
|     . = ..      |
|    . + S  o  .oo|
|     = o .. +oo+o|
|    + +.o  + E* +|
|   . =..o+  +B..*|
|    ....====+.=.o|
jenkins@46e0509ddfae:/$ ssh-copy-id
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/var/jenkins_home/.ssh/"
The authenticity of host ' (' can't be established.
ECDSA key fingerprint is SHA256:1ZZ+BrXKS7IGTYM+De6Fulq1LK3CIMRhxZmhmB+WrWE.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh ''"
and check to make sure that only the key(s) you wanted were added.

jenkins@46e0509ddfae:/$ ssh
Last login: Thu Aug 29 18:46:15 2019 from
bb-l-m-gd-200:~ jenkins$ 
bb-l-m-gd-200:~ jenkins$ hostname 
bb-l-m-gd-200:~ jenkins$ 
bb-l-m-gd-200:~ jenkins$ cat /private/etc/ssh/sshd_config|grep  PubkeyAuthentication
PubkeyAuthentication yes
bb-l-m-gd-200:~ jenkins$ 
bb-l-m-gd-200:~ jenkins$ ls -l ~/.ssh/authorized_keys 
-rw-------  1 jenkins  staff  804 Aug 29 18:48 /Users/gdajuk/projects/repo/.ssh/authorized_keys
bb-l-m-gd-200:~ jenkins$ 
bb-l-m-gd-200:~ jenkins$ logout
Connection to closed.
jenkins@46e0509ddfae:/$ exit
mum@bb-l-m-gd-200 ~/projects/repo$
Old 08-30-2019, 02:09 AM   #2
Registered: Nov 2008
Posts: 111

Original Poster
Rep: Reputation: 24
The host is fresh, so there are no more keys there.
Even I provide the key from the CLI after ssh, it doesn't help..


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Jenkins + Docker issue DennyY Linux - Newbie 10 06-06-2019 10:47 AM
LXer: How to easily add ssh credentials on Jenkins Server LXer Syndicated Linux News 0 05-14-2018 04:15 PM
LXer: Jenkins All-In With Docker Containers to Enhance DevOps Workflow LXer Syndicated Linux News 0 06-20-2015 11:14 AM
Where did the Jenkins in Jenkins CI come from? vmccord General 2 10-13-2014 02:10 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:42 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration