再来过-docker

$ sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine

安装一些必要的系统工具:

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

添加软件源信息:

sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

更新 yum 缓存:

sudo yum makecache fast

安装 Docker-ce:

sudo yum -y install docker-ce

启动 Docker 后台服务

sudo systemctl start docker

多域名解析处理

docker run --name=nginx -p 80:80 -v /app/nginx/www:/usr/share/nginx/html -v /app/nginx/conf.d:/etc/nginx/conf.d -d nginx
vi /app/nginx/conf.d/gogs.conf
server {
    listen 80;
    server_name blog.chenhailong.online;    # 把域名替换成你自己的
    location / {
    proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://47.99.211.128:6666;      # 这里设置你要代理的ip+端口
      }
}
server {
    listen 80;
    server_name taro.chenhailong.online;    # 把域名替换成你自己的
    location / {
    proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://47.99.211.128:7071;      # 这里设置你要代理的ip+端口
      }
}
server {
    listen 80;
    server_name introduce.chenhailong.online;    # 把域名替换成你自己的
    location / {
    proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://47.99.211.128:7072;      # 这里设置你要代理的ip+端口
      }
}
server {
    listen 80;
    server_name jenkins.chenhailong.online;    # 把域名替换成你自己的
    location / {
    proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://47.99.211.128:8080;      # 这里设置你要代理的ip+端口
      }
}
docker exec -it nginx /etc/init.d/nginx reload

jenkins

#   -u root  --name myJenkins
docker run -u root --name myJenkins -d --restart=always -p 8080:8080 -v /root/jenkins-data:/var/jenkins_home -v  /var/run/docker.sock:/var/run/docker.sock -v "$HOME"/jenkins:/home jenkinsci/blueocean
docker exec -it myJenkins bash
cat /var/jenkins_home/secrets/initialAdminPassword
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>${ENV, var="JOB_NAME"}-第${BUILD_NUMBER}次构建日志</title>
</head>
 
 
<body leftmargin="8" marginwidth="0" topmargin="8" marginheight="4" offset="0">
    <table width="95%" cellpadding="0" cellspacing="0" style="font-size: 11pt; font-family: Tahoma, Arial, Helvetica, sans-serif">
        <tr>
            <td>(本邮件由程序自动下发,请勿回复!)</td>
        </tr>
        <tr>
            <td>
                <h2><font color="#FF0000">构建结果 - ${BUILD_STATUS}</font></h2>
            </td>
        </tr>
        <tr>
            <td><br />
                <b><font color="#0B610B">构建信息</font></b>
                <hr size="2" width="100%" align="center" />
            </td>
        </tr>
        <tr><a href="${PROJECT_URL}">${PROJECT_URL}</a>
            <td>
                <ul>
                    <li>项目名称:${PROJECT_NAME}</li>
                    <li>GIT路径:<a href="${GIT_URL}">${GIT_URL}</a></li>                    
                    <li>构建编号:${BUILD_NUMBER}</li>                    
                    <li>触发原因:${CAUSE}</li>   
                    <li>构建日志:<a href="${BUILD_URL}console">${BUILD_URL}console</a></li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                <b><font color="#0B610B">变更信息:</font></b>
               <hr size="2" width="100%" align="center" />
            </td>
        </tr>
        <tr>
            <td>
                <ul>
                    <li>上次构建成功后变化 :  ${CHANGES_SINCE_LAST_SUCCESS}</a></li>
                </ul>    
            </td>
        </tr>
 <tr>
            <td>
                <ul>
                    <li>上次构建不稳定后变化 :  ${CHANGES_SINCE_LAST_UNSTABLE}</a></li>
                </ul>    
            </td>
        </tr>
        <tr>
            <td>
                <ul>
                    <li>历史变更记录 : <a href="${PROJECT_URL}changes">${PROJECT_URL}changes</a></li>
                </ul>    
            </td>
        </tr>
        <tr>
            <td>
                <ul>
                    <li>变更集:${JELLY_SCRIPT,template="html"}</a></li>
                </ul>    
            </td>
        </tr>
        <!--
        <tr>
            <td>
                <b><font color="#0B610B">Failed Test Results</font></b>
                <hr size="2" width="100%" align="center" />
            </td>
        </tr>
        <tr>
            <td>
                <pre style="font-size: 11pt; font-family: Tahoma, Arial, Helvetica, sans-serif">$FAILED_TESTS</pre>
                <br />
            </td>
        </tr>
        
        <tr>
            <td>
                <b><font color="#0B610B">构建日志 (最后 100行):</font></b>
                <hr size="2" width="100%" align="center" />
            </td>
        </tr>-->
        <!-- <tr>
            <td>Test Logs (if test has ran): <a
                href="${PROJECT_URL}ws/TestResult/archive_logs/Log-Build-${BUILD_NUMBER}.zip">${PROJECT_URL}/ws/TestResult/archive_logs/Log-Build-${BUILD_NUMBER}.zip</a>
                <br />
            <br />
            </td>
        </tr> -->
        <!--
        <tr>
            <td>
                <textarea cols="80" rows="30" readonly="readonly" style="font-family: Courier New">${BUILD_LOG, maxLines=100,escapeHtml=true}</textarea>
            </td>
        </tr>-->
        <hr size="2" width="100%" align="center" />
 
    </table>
 
 
</body>
</html>

// 无法运行docker 命令
docker run --name jenkins  -u root  -p 8080:8080 -p 50000:50000 -d  -v /home/jenkins-home-docker:/var/jenkins_home  jenkins/jenkins:lts

// 无法加载资源
docker run --name jenkins  -u root  -p 8180:8080 -p 50000:50000 -d  -v /home/jenkins:/var/jenkins_home hub.c.163.com/library/jenkins
// 无法加载资源
docker run -p 8080:8080 -p 50000:50000 -v /your/home:/var/jenkins_home jenkins
docker run --name jenkins  -u root  -p 8080:8080 -p 50000:50000 -d  -v /home/jenkins_home:/var/jenkins_home jenkins



docker run --name blueocean  -u root  -p 8080:8080  -d  -v /home/blueocean:/var/jenkins_home jenkinsci/blueocean

docker exec -ti jenkins whoami

升级Docker方式安装的Jenkins版本

wget http://mirrors.jenkins.io/war/latest/jenkins.war
docker cp jenkins.war 7415ceb55add:/usr/download
docker exec -it -u root 7415ceb55add bash
cp /usr/download/jenkins.war /usr/share/jenkins


docker cp jenkins.war 7415ceb55add:/usr/share/jenkins
// 什么鬼
[root@iZbp1hun1qsl59e2nzqyvcZ jen]# docker cp jenkins.war 7415ceb55add:/usr/download
[root@iZbp1hun1qsl59e2nzqyvcZ jen]# docker exec -it -u root 7415ceb55add bash
root@7415ceb55add:/# cp /usr/download/jenkins.war /usr/share/jenkins
cp: cannot stat '/usr/download/jenkins.war': Not a directory
root@7415ceb55add:/# cd usr
root@7415ceb55add:/usr# cd download 
bash: cd: download: Not a directory
root@7415ceb55add:/usr# ls
bin  download  games  include  lib  local  sbin  share	src
root@7415ceb55add:/usr# cd download 
bash: cd: download: Not a directory
root@7415ceb55add:/usr# ls
bin  download  games  include  lib  local  sbin  share	src
root@7415ceb55add:/usr# cd download 
bash: cd: download: Not a directory
root@7415ceb55add:/usr# 

docker run -itd --name jenkins -p 8080:8080 -p 50000:50000 -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v /home/jenkins-home-docker:/var/jenkins_home --env JAVA_OPTS="-Xms256m -Xmx512m  -XX:MaxNewSize=256m"  -u root  -v /usr/lib64/libltdl.so.7:/usr/lib/x86_64-linux-gnu/libltdl.so.7 jenkins
113b957b3c0695a75f6ddd4d6d7cbe4a18372fa5

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值