查看“Using Jenkins agents with docker”的源代码
←
Using Jenkins agents with docker
跳到导航
跳到搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
== ** Generating an SSH key pair == ssh-keygen -t dsa -f ~/.ssh/jenkins_agent_key ==*** Create a Jenkins SSH credential == <pre> Go to your Jenkins dashboard; Go to Manage Jenkins option in main menu and click on credentials button; select the drop option Add Credentials from the global item; Fill the form: Kind: SSH Username with private key; id: jenkins description: The jenkins ssh key username: jenkins Private Key: select Enter directly and press the Add button to insert your private key from ~/.ssh/jenkins_agent_key Passphrase: fill your passphrase used to generate the SSH key pair and then press OK </pre> ==** Creating your Docker agent == <pre> run the command to start your first agent: docker run -d --rm --name=agent1 -p 22:22 \ -e "JENKINS_AGENT_SSH_PUBKEY=[your-public-key]" \ jenkins/ssh-agent:alpine 实际替换上你的pub key docker run -d --rm --name=agent1 -p 222:22 \ -e "JENKINS_AGENT_SSH_PUBKEY=ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCljcroCTtT+Qipw8NvncMZx731Dv4fjZPt09JaD+aR3jdNWp5e\ bpKJQGD12UzN6/2lRPHipIroY/WKt+MIy9y+0iQ1Om+nl01j6GHkVeGVhoKCmv4dRQgvoczYHO5ccXNo\ uVeTnopg+4UiKWzimOVE0pcu06H//OFEGR24BT8bBAHrV17EYshhY09I9LXzw8O+oSsn217frmNNEfUo\ aq72verbEUrPS/NfBwdb4W4Pfdc874bUcnt7UEFa9VSSeLFa0Xp7xzNurZye+m9WAn/WhjDXQJgZE3Ql\ yYLc6ZT9k4EdXlJgF/GeZ4wX4p9itnmimMiYy+eieb4jwHlAWryh root@gitlabzbx " \ jenkins/ssh-agent:alpine Now run the following command to update the container environment: $ VARS1="HOME=|USER=|MAIL=|LC_ALL=|LS_COLORS=|LANG=" $ VARS2="HOSTNAME=|PWD=|TERM=|SHLVL=|LANGUAGE=|_=" $ VARS="${VARS1}|${VARS2}" $ docker exec agent1 sh -c "env | egrep -v '^(${VARS})' >> /etc/environment" </pre>
返回至
Using Jenkins agents with docker
。
导航菜单
个人工具
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
我的导航
关于我
shell
python
ops
linuxchina.net
blog.linuxchina
最近更改
随机页面
帮助
工具
链入页面
相关更改
特殊页面
页面信息