Copiar chave ssh entre container docker para Jenkin... | Fórum | School of Net

Deseja poder participar de nosso fórum e tirar todas as suas dúvidas?
Clique aqui e assine nosso plano de acesso ilimitado. Saiba mais.

por Danilo Marcus

2 semanas atrás Danilo Marcus

Copiar chave ssh entre container docker para Jenkins - Master e Slave

Olá, estou fazendo o curso usando Docker. Agora estou configurando o slave para o Jenkins Estou com o seguinte cenário rodando no WIndows com WSL2: Este é meu Docker Compose com o jenkins ``` version: '3' services: docker: image: docker:dind container_name: jenkins-docker networks: - jenkins environment: - DOCKER_TLS_CERTDIR=/certs volumes: - ./jenkins-docker-certs:/certs/client - ./jenkins-data:/var/jenkins_home privileged: true ports: - "2376:2376" jenkins-blueocean: image: myjenkins-blueocean:2.361.2-1 container_name: jenkins-blueocean networks: - jenkins restart: on-failure environment: - DOCKER_HOST=tcp://docker:2376 - DOCKER_CERT_PATH=/certs/client - DOCKER_TLS_VERIFY=1 ports: - "8080:8080" - "50000:50000" volumes: - ./jenkins-data:/var/jenkins_home - ./jenkins-docker-certs:/certs/client:ro networks: jenkins: ``` Agora a máquina para o Slave eu fiz da seguinte forma: ``` FROM ubuntu:20.04 CMD [ "bash" ] ``` Fiz a instalação de todos os pacotes necessários passados na aula: ``` sudo apt-get install software-properties-common -y sudo add-apt-repository ppa:openjdk-r/ppa -y sudo apt install openjdk-11-jdk -y ``` Criei e exportei a chave ssh para o jenkins master e criei o user global. O erro se dá ao tentar copiar a chave: ``` [email protected]:/# cat /etc/passwd root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin sys:x:3:3:sys:/dev:/usr/sbin/nologin sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/usr/sbin/nologin man:x:6:12:man:/var/cache/man:/usr/sbin/nologin lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin mail:x:8:8:mail:/var/mail:/usr/sbin/nologin news:x:9:9:news:/var/spool/news:/usr/sbin/nologin uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin proxy:x:13:13:proxy:/bin:/usr/sbin/nologin www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin backup:x:34:34:backup:/var/backups:/usr/sbin/nologin list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin _apt:x:100:65534::/nonexistent:/usr/sbin/nologin systemd-timesync:x:101:101:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin systemd-network:x:102:103:systemd Network Management,,,:/run/systemd:/usr/sbin/nologin systemd-resolve:x:103:104:systemd Resolver,,,:/run/systemd:/usr/sbin/nologin messagebus:x:104:105::/nonexistent:/usr/sbin/nologin Jenkins:x:1000:1000::/home/Jenkins:/bin/bash sshd:x:105:65534::/run/sshd:/usr/sbin/nologin jenkins:x:1001:1001::/home/jenkins:/bin/bash [email protected]:/# ssh-copy-id [email protected] /usr/bin/ssh-copy-id: ERROR: No identities found [email protected]:/# su - jenkins [email protected]:~$ ssh-copy-id [email protected] /usr/bin/ssh-copy-id: ERROR: No identities found [email protected]:~$ ``` Os containers conseguem dar PING, fiz o teste.

2 Respostas