我有以下坞站组成配置:
version: '3.3'
services:
jenkins:
image: jenkins-ansible
build: ansible
restart: on-failure
privileged: true
user: root
ports:
- 8080:8080
- 5000:5000
container_name: jenkins
volumes:
- /home/juliano/workspace/docker-projects/jenkins/volume/:/var/jenkins_home
- /var/run/docker.sock:/var/run/docker.sock
- /usr/local/bin/docker:/usr/local/bin/docker
jenkins-agent-1:
build:
context: jenkins-agent
restart: on-failure
expose:
- "22"
container_name: jenkins-agent-1
environment:
- JENKINS_AGENT_SSH_PUBKEY=ssh-rsa omitted
- JAVA_HOME=/opt/java/openjdk/bin/java
depends_on:
- jenkins
volumes:
- /home/juliano/workspace/docker-projects/jenkins/volume/:/var/jenkins_home
jenkins-agent-2:
# image: jenkins/ssh-agent:jdk11
build:
context: jenkins-agent
restart: on-failure
expose:
- "22"
container_name: jenkins-agent-2
environment:
- JENKINS_AGENT_SSH_PUBKEY=ssh-rsa omitted
- JAVA_HOME=/opt/java/openjdk/bin/java
depends_on:
- jenkins
volumes:
- /home/juliano/workspace/docker-projects/jenkins/volume/:/var/jenkins_home
remote_host:
container_name: remote-host
image: remote-host
build:
context: ubuntu18.04
我收到以下错误消息:
+ env
+ [[ ssh-rsa omitted == ssh-* ]]
+ write_key 'ssh-rsa omitted'
+ local ID_GROUP
++ stat -c %U:%G /home/jenkins
+ ID_GROUP=jenkins:jenkins
+ mkdir -p /home/jenkins/.ssh
+ echo 'ssh-rsa omitted'
+ chown -Rf jenkins:jenkins /home/jenkins/.ssh
+ chmod 0700 -R /home/jenkins/.ssh
+ [[ '' == ssh-* ]]
+ env
+ grep _
/usr/local/bin/setup-sshd: line 54: /etc/environment: Permission denied
Jenkins代理文档是:
FROM jenkins/ssh-agent
USER root
RUN apt-get update && apt-get install python3 -y
RUN apt-get install curl -y
RUN apt-get install python3-distutils -y
RUN curl -O https://bootstrap.pypa.io/get-pip.py &&
python3 get-pip.py &&
pip install ansible --upgrade
USER jenkins
以前,我使用jenkins/ssh-agent:jdk11构建代理,并且运行良好。然后,我尝试通过Jenkins-agent Dockerfile将Ansible安装到代理中,但没有成功(收到前面提到的错误)。现在,即使我将jenkins-agent更改为jenkins/ssh-agent:jdk11,它也会遇到相同的问题。
有谁能帮帮我,好吗?
1条答案
按热度按时间mv1qrgav1#
我更改了jenkins-agent/Dockerfile,并删除了用户根和用户jenkins。
现在,它正在发挥作用。