docker jenkins - TuPengXiong/TuPengXiong.github.io GitHub Wiki

docker jenkins

查找 jenkins 镜像

docker search jenkins

获取 jenkins 镜像

docker pull jenkins

启动jenkins 容器

docker run -itd --name jenkins -p 9999:8080 jenkins

nginx 配置

upstream jenkins2 {
  server 127.0.0.1:9999;
}

server {
  listen *:80;
  server_name ci2.kingsilk.xyz;
  server_tokens off;
  root /notExisted;

  client_max_body_size 20m;
  ignore_invalid_headers off;   # 否则会 : 405 not a valid crumb was include in the request    

  access_log  logs/jenkins.access.log;
  error_log   logs/jenkins.error.log;

  location / { 
        proxy_pass              http://jenkins2;
        proxy_set_header        Host            $host;   # ???  $http_host;
        proxy_set_header        X-Real-IP       $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        X-Forwarded-Proto $scheme;
  }
}

访问 jenkins

http://ci2.kingsilk.xyz

默认密码 存放在 :/var/jenkins_home/secrets/initialAdminPassword

docker exec -it jenkins bash
cat  /var/jenkins_home/secrets/initialAdminPassword