• docker 部署 jenkins


      建议使用的Docker映像是jenkinsci/blueocean image(来自 the Docker Hub repository)。 该镜像包含当前的长期支持 (LTS) 的Jenkins版本 (可以投入使用) ,捆绑了所有Blue Ocean插件和功能。

    部署方法:

    docker run 
      -u root 
      --name jenkins 
      -d 
      -p 8080:8080 
      -p 50000:50000 
      -v jenkins-data:/var/jenkins_home 
      -v /var/run/docker.sock:/var/run/docker.sock 
      jenkinsci/blueocean

    参数说明:

    --name jenkins         (可选)指定容器名称

    -d                (可选)jenkinsci/blueocean 在后台运行容器(即“分离”模式)并输出容器ID。如果您不指定此选项, 则在终端窗口中输出正在运行的此容器的Docker日志。

    -p 8080:8080        映射jenkinsci/blueocean 容器的端口8080到主机上的端口8080。 第一个数字代表主机上的端口,而最后一个代表容器的端口。如果您为此选项指定 -p 49000:8080 ,您将通过端口49000访问主机上的Jenkins。

    -p 50000:50000        可选)将 jenkinsci/blueocean 容器的端口50000 映射到主机上的端口50000。 如果您在其他机器上设置了一个或多个基于JNLP的Jenkins代理程序,而这些代理程序又与 jenkinsci/blueocean 容器交互(充当“主”Jenkins服务器,或者简称为“Jenkins主”), 则这是必需的。默认情况下,基于JNLP的Jenkins代理通过TCP端口50000与Jenkins主站进行通信。

    -v jenkins-data:/var/jenkins_home        (可选,但强烈建议)映射在容器中的`/var/jenkins_home` 目录到具有名字 jenkins-data 的volume。 如果这个卷不存在,那么这个 docker run 命令会自动为你创建卷。 如果您希望每次重新启动Jenkins(通过此 docker run ... 命令)时保持Jenkins状态,则此选项是必需的 。 

    -v /var/run/docker.sock:/var/run/docker.sock        (可选 /var/run/docker.sock 表示Docker守护程序通过其监听的基于Unix的套接字。 该映射允许 jenkinsci/blueocean 容器与Docker守护进程通信, 如果 jenkinsci/blueocean 容器需要实例化其他Docker容器,则该守护进程是必需的。 

    jenkinsci/blueocean        jenkinsci/blueocean Docker镜像本身。如果此镜像尚未下载,则此 docker run 命令 将自动为您下载镜像。此外,如果自上次运行此命令后发布了此镜像的任何更新, 则再次运行此命令将自动为您下载这些已发布的镜像更新。 注意:这个Docker镜像也可以使用以下 docker pull命令独立下载(或更新) : docker pull jenkinsci/blueocean

      此安装方法取自jenkins官方安装文档。

    配置实例:

    [root@localhost ~]# docker run 
    >   -u root 
    >   --name jenkins 
    >   -d 
    >   -p 8080:8080 
    >   -p 50000:50000 
    >   -v jenkins-data:/var/jenkins_home 
    >   -v /var/run/docker.sock:/var/run/docker.sock 
    >   jenkinsci/blueocean
    Unable to find image 'jenkinsci/blueocean:latest' locally
    latest: Pulling from jenkinsci/blueocean
    bdf0201b3a05: Pull complete 
    9e12771959ad: Pull complete 
    018b76c3c533: Pull complete 
    fb7916dfb471: Pull complete 
    efeeaeb1034e: Pull complete 
    9d0828dae329: Pull complete 
    93c94dc28c28: Pull complete 
    51c9f4cab046: Pull complete 
    1529253d9fb0: Pull complete 
    0308c8ef7639: Pull complete 
    e701e5d6451c: Pull complete 
    3a0b79c07d56: Pull complete 
    28c17bce8836: Pull complete 
    d1e02b0dadf5: Pull complete 
    2a22db2a9af0: Pull complete 
    Digest: sha256:6cb529ad8c56539e4480a567a1b86a1926fa667de55db6fb4e795e13af6509f7
    Status: Downloaded newer image for jenkinsci/blueocean:latest
    1ac2c92cf7b2b4c58cab5c17046683da6be5781ba31b6c7b9533f24c0f89b190

    打开web管理页面:

    密码可以从docker logs 中查找到:

    [root@localhost ~]# docker logs jenkins
    Running from: /usr/share/jenkins/jenkins.war
    webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
    May 22, 2019 2:36:57 AM org.eclipse.jetty.util.log.Log initialized
    INFO: Logging initialized @485ms to org.eclipse.jetty.util.log.JavaUtilLog
    May 22, 2019 2:36:57 AM winstone.Logger logInternal
    INFO: Beginning extraction from war file
    May 22, 2019 2:36:59 AM org.eclipse.jetty.server.handler.ContextHandler setContextPath
    WARNING: Empty contextPath
    May 22, 2019 2:36:59 AM org.eclipse.jetty.server.Server doStart
    INFO: jetty-9.4.z-SNAPSHOT; built: 2018-08-30T13:59:14.071Z; git: 27208684755d94a92186989f695db2d7b21ebc51; jvm 1.8.0_212-b04
    May 22, 2019 2:36:59 AM org.eclipse.jetty.webapp.StandardDescriptorProcessor visitServlet
    INFO: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
    May 22, 2019 2:36:59 AM org.eclipse.jetty.server.session.DefaultSessionIdManager doStart
    INFO: DefaultSessionIdManager workerName=node0
    May 22, 2019 2:36:59 AM org.eclipse.jetty.server.session.DefaultSessionIdManager doStart
    INFO: No SessionScavenger set, using defaults
    May 22, 2019 2:36:59 AM org.eclipse.jetty.server.session.HouseKeeper startScavenging
    INFO: node0 Scavenging every 660000ms
    Jenkins home directory: /var/jenkins_home found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
    May 22, 2019 2:37:00 AM org.eclipse.jetty.server.handler.ContextHandler doStart
    INFO: Started w.@7689ddef{Jenkins v2.164.3,/,file:///var/jenkins_home/war/,AVAILABLE}{/var/jenkins_home/war}
    May 22, 2019 2:37:00 AM org.eclipse.jetty.server.AbstractConnector doStart
    INFO: Started ServerConnector@1df98368{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
    May 22, 2019 2:37:00 AM org.eclipse.jetty.server.Server doStart
    INFO: Started @3346ms
    May 22, 2019 2:37:00 AM winstone.Logger logInternal
    INFO: Winstone Servlet Engine v4.0 running: controlPort=disabled
    May 22, 2019 2:37:01 AM jenkins.InitReactorRunner$1 onAttained
    INFO: Started initialization
    May 22, 2019 2:37:03 AM jenkins.InitReactorRunner$1 onAttained
    INFO: Listed all plugins
    May 22, 2019 2:37:10 AM jenkins.InitReactorRunner$1 onAttained
    INFO: Prepared all plugins
    May 22, 2019 2:37:10 AM jenkins.InitReactorRunner$1 onAttained
    INFO: Started all plugins
    May 22, 2019 2:37:12 AM jenkins.InitReactorRunner$1 onAttained
    INFO: Augmented all extensions
    May 22, 2019 2:37:12 AM jenkins.InitReactorRunner$1 onAttained
    INFO: Loaded all jobs
    May 22, 2019 2:37:12 AM hudson.model.AsyncPeriodicWork$1 run
    INFO: Started Download metadata
    May 22, 2019 2:37:12 AM hudson.util.Retrier start
    INFO: Attempt #1 to do the action check updates server
    May 22, 2019 2:37:13 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
    INFO: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@47fafdbc: display name [Root WebApplicationContext]; startup date [Wed May 22 02:37:13 GMT 2019]; root of context hierarchy
    May 22, 2019 2:37:13 AM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
    INFO: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@47fafdbc]: org.springframework.beans.factory.support.DefaultListableBeanFactory@4bc62933
    May 22, 2019 2:37:13 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
    INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@4bc62933: defining beans [authenticationManager]; root of factory hierarchy
    May 22, 2019 2:37:13 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
    INFO: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@4c2b95b7: display name [Root WebApplicationContext]; startup date [Wed May 22 02:37:13 GMT 2019]; root of context hierarchy
    May 22, 2019 2:37:13 AM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
    INFO: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@4c2b95b7]: org.springframework.beans.factory.support.DefaultListableBeanFactory@630931a0
    May 22, 2019 2:37:13 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
    INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@630931a0: defining beans [filter,legacy]; root of factory hierarchy
    May 22, 2019 2:37:13 AM jenkins.install.SetupWizard init
    INFO: 
    
    *************************************************************
    *************************************************************
    *************************************************************
    
    Jenkins initial setup is required. An admin user has been created and a password generated.
    Please use the following password to proceed to installation:
    
    afc3cd17d54d40379d9c880d21af457d
    
    This may also be found at: /var/jenkins_home/secrets/initialAdminPassword
    
    *************************************************************
    *************************************************************
    *************************************************************
    
    May 22, 2019 2:37:24 AM hudson.model.UpdateSite updateData
    INFO: Obtained the latest update center data file for UpdateSource default
    May 22, 2019 2:37:25 AM hudson.model.DownloadService$Downloadable load
    INFO: Obtained the updated data file for hudson.tasks.Maven.MavenInstaller
    May 22, 2019 2:37:25 AM hudson.util.Retrier start
    INFO: Performed the action check updates server successfully at the attempt #1
    May 22, 2019 2:37:25 AM hudson.model.AsyncPeriodicWork$1 run
    INFO: Finished Download metadata. 12,955 ms
    May 22, 2019 2:37:26 AM hudson.model.UpdateSite updateData
    INFO: Obtained the latest update center data file for UpdateSource default
    May 22, 2019 2:37:26 AM jenkins.InitReactorRunner$1 onAttained
    INFO: Completed initialization
    May 22, 2019 2:37:26 AM hudson.WebAppMain$3 run
    INFO: Jenkins is fully up and running

    将密码粘贴后,点击确定,到一下一个页面:

    在下个页面中可以选择插件,并安装:

    开始安装:

    安装完成后输入必要的配置信息,界面如下:

    到此,安装完成。

    界面如下:

  • 相关阅读:
    sequence.c
     Link 
    转:MFC中屏蔽ESC和回车关闭对话框
    转:CWebBrowser2去除边框、滚动条、右键菜单
    VC:res协议——从模块中获取资源
    20131213
    20131212
    20131211
    20131205
    20131128
  • 原文地址:https://www.cnblogs.com/yyxianren/p/10904518.html
Copyright © 2020-2023  润新知