日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

【实战练习】通过docker部署jenkins

發布時間:2024/7/19 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【实战练习】通过docker部署jenkins 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
jenkins官網 :https://jenkins.io/

拉取jenkins ??

Official Jenkins Docker image


  • [root@ip-172-31-16-58 ec2-user]# docker pull jenkins/jenkins
  • Using default tag: latest
  • latest: Pulling from jenkins/jenkins
  • 06b22ddb1913: Pull complete
  • 336c28b408ed: Pull complete
  • 1f3e6b8d80c3: Pull complete
  • 5ccc640979f6: Pull complete
  • 14eaa20184e6: Pull complete
  • 19a8522e2399: Pull complete
  • 39ba9d7befca: Pull complete
  • 1f81f3143db2: Pull complete
  • 2034c15120cd: Pull complete
  • cb9c7784507a: Pull complete
  • 160eb3637188: Pull complete
  • 6f0079684645: Pull complete
  • d03cc51cd013: Pull complete
  • 5c83a5102435: Pull complete
  • d1615ed88d09: Pull complete
  • 184c2f70a0cf: Pull complete
  • 468b123e967f: Pull complete
  • f1ae15a4cfc0: Pull complete
  • 02f7a795bd75: Pull complete
  • bdac05821dbe: Pull complete
  • Digest: sha256:30f648f79d447aab092a1a8a2025ee90e257fc03245796a89fb8ffac638259ee
  • Status: Downloaded newer image for jenkins/jenkins:latest

  • 操作手冊:https://github.com/jenkinsci/docker/blob/master/README.md


  • docker run 命令詳細文檔
  • [root@ip-172-31-16-58 ec2-user]# docker run --help
  • Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
  • Run a command in a new container
  • Options:
  • --add-host list Add a custom host-to-IP mapping (host:ip) (default [])
  • -a, --attach list Attach to STDIN, STDOUT or STDERR (default [])
  • --blkio-weight uint16 Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)
  • --blkio-weight-device weighted-device Block IO weight (relative device weight) (default [])
  • --cap-add list Add Linux capabilities (default [])
  • --cap-drop list Drop Linux capabilities (default [])
  • --cgroup-parent string Optional parent cgroup for the container
  • --cidfile string Write the container ID to the file
  • --cpu-count int CPU count (Windows only)
  • --cpu-percent int CPU percent (Windows only)
  • --cpu-period int Limit CPU CFS (Completely Fair Scheduler) period
  • --cpu-quota int Limit CPU CFS (Completely Fair Scheduler) quota
  • --cpu-rt-period int Limit CPU real-time period in microseconds
  • --cpu-rt-runtime int Limit CPU real-time runtime in microseconds
  • -c, --cpu-shares int CPU shares (relative weight) //用于給運行在容器中的所有進程分配CPU的shares值。這是一個相對權重,實際的處理速度還與宿主機CPU相關
  • --cpus decimal Number of CPUs (default 0.000)
  • --cpuset-cpus string CPUs in which to allow execution (0-3, 0,1)
  • --cpuset-mems string MEMs in which to allow execution (0-3, 0,1)
  • --credentialspec string Credential spec for managed service account (Windows only)
  • -d, --detach Run container in background and print container ID
  • --detach-keys string Override the key sequence for detaching a container
  • --device list Add a host device to the container (default [])
  • --device-read-bps throttled-device Limit read rate (bytes per second) from a device (default [])
  • --device-read-iops throttled-device Limit read rate (IO per second) from a device (default [])
  • --device-write-bps throttled-device Limit write rate (bytes per second) to a device (default [])
  • --device-write-iops throttled-device Limit write rate (IO per second) to a device (default [])
  • --disable-content-trust Skip image verification (default true)
  • --dns list Set custom DNS servers (default [])
  • --dns-option list Set DNS options (default [])
  • --dns-search list Set custom DNS search domains (default [])
  • --entrypoint string Overwrite the default ENTRYPOINT of the image
  • -e, --env list Set environment variables (default [])
  • --env-file list Read in a file of environment variables (default [])
  • --expose list Expose a port or a range of ports (default [])
  • --group-add list Add additional groups to join (default [])
  • --health-cmd string Command to run to check health
  • --health-interval duration Time between running the check (ns|us|ms|s|m|h) (default 0s)
  • --health-retries int Consecutive failures needed to report unhealthy
  • --health-timeout duration Maximum time to allow one check to run (ns|us|ms|s|m|h) (default 0s)
  • --help Print usage
  • -h, --hostname string Container host name
  • --init Run an init inside the container that forwards signals and reaps processes
  • --init-path string Path to the docker-init binary
  • -i, --interactive Keep STDIN open even if not attached //保持輸入打開即使不連接 即選擇交互模式,始終保持輸入流開放
  • --io-maxbandwidth string Maximum IO bandwidth limit for the system drive (Windows only)
  • --io-maxiops uint Maximum IOps limit for the system drive (Windows only)
  • --ip string Container IPv4 address (e.g. 172.30.100.104)
  • --ip6 string Container IPv6 address (e.g. 2001:db8::33)
  • --ipc string IPC namespace to use
  • --isolation string Container isolation technology
  • --kernel-memory string Kernel memory limit
  • -l, --label list Set meta data on a container (default [])
  • --label-file list Read in a line delimited file of labels (default [])
  • --link list Add link to another container (default [])
  • --link-local-ip list Container IPv4/IPv6 link-local addresses (default [])
  • --log-driver string Logging driver for the container
  • --log-opt list Log driver options (default [])
  • --mac-address string Container MAC address (e.g. 92:d0:c6:0a:29:33)
  • -m, --memory string Memory limit //限制容器為所有進程分配的內存總量
  • --memory-reservation string Memory soft limit
  • --memory-swap string Swap limit equal to memory plus swap: '-1' to enable unlimited swap
  • --memory-swappiness int Tune container memory swappiness (0 to 100) (default -1)
  • --name string Assign a name to the container
  • --network string Connect a container to a network (default "default")
  • --network-alias list Add network-scoped alias for the container (default [])
  • --no-healthcheck Disable any container-specified HEALTHCHECK
  • --oom-kill-disable Disable OOM Killer
  • --oom-score-adj int Tune host's OOM preferences (-1000 to 1000)
  • --pid string PID namespace to use
  • --pids-limit int Tune container pids limit (set -1 for unlimited)
  • --privileged Give extended privileges to this container
  • -p, --publish list Publish a container's port(s) to the host (default []) //端口映射到本機 將容器的端口暴漏給宿主機的端口
  • -P, --publish-all Publish all exposed ports to random ports
  • --read-only Mount the container's root filesystem as read only
  • --restart string Restart policy to apply when a container exits (default "no")
  • --rm Automatically remove the container when it exits
  • --runtime string Runtime to use for this container
  • --security-opt list Security Options (default [])
  • --shm-size string Size of /dev/shm, default value is 64MB
  • --sig-proxy Proxy received signals to the process (default true)
  • --stop-signal string Signal to stop a container, SIGTERM by default (default "SIGTERM")
  • --stop-timeout int Timeout (in seconds) to stop a container
  • --storage-opt list Storage driver options for the container (default [])
  • --sysctl map Sysctl options (default map[])
  • --tmpfs list Mount a tmpfs directory (default [])
  • -t, --tty Allocate a pseudo-TTY //分配一個偽終端,一般兩個參數結合是使用 -it,就可以在容器中利用打開的偽終端進行交互操作
  • --ulimit ulimit Ulimit options (default [])
  • -u, --user string Username or UID (format: <name|uid>[:<group|gid>])
  • --userns string User namespace to use
  • --uts string UTS namespace to use
  • -v, --volume list Bind mount a volume (default []) //用戶掛載一個volume 可以用多個-v掛載讀個 。volume的格式為[host-dir]:[container-dir]:[rw|ro]
  • --volume-driver string Optional volume driver for the container
  • --volumes-from list Mount volumes from the specified container(s) (default [])
  • -w, --workdir string Working directory inside the container
  • 注釋:volume:LVM幾個基本概念*物理存儲介質(PhysicalStorageMedia):指系統的物理存儲設備:磁盤,如:/dev/hda、/dev/sda等,是存儲系統最底層的存儲單元。*物理卷(Physical Volume,PV):指磁盤分區或從邏輯上與磁盤分區具有同樣功能的設備(如RAID),是LVM的基本存儲邏輯塊,但和基本的物理存儲介質(如分區、磁盤等)比較,卻包含有與LVM相關的管理參數。*物理塊(Physical Extent,PE):每一個物理卷PV被劃分為稱為PE(Physical Extents)的基本單元,具有唯一編號的PE是可以被LVM尋址的最小單元。PE的大小是可配置的,默認為4MB。所以物理卷(PV)由大小等同的基本單元PE組成。*卷組(Volume Group,VG):類似于非LVM系統中的物理磁盤,其由一個或多個物理卷PV組成。可以在卷組上創建一個或多個LV(邏輯卷)。*邏輯卷(Logical Volume,LV):類似于非LVM系統中的磁盤分區,邏輯卷建立在卷組VG之上。在邏輯卷LV之上可以建立文件系統(比如/home或者/usr等)。*邏輯塊(Logical Extent,LE):邏輯卷LV也被劃分為可被尋址的基本單位,稱為LE。在同一個卷組中,LE的大小和PE是相同的,并且一一對應。
    來源:?http://doc.okbase.net/sammyliu/archive/118273.html
    運行記錄?
  • [root@ip-172-31-16-58 ec2-user]# docker run -p 8080:8080 -p 50000:50000 -v jenkins_home:/var/jenkins_home jenkins/jenkins
  • docker: Error response from daemon: driver failed programming external connectivity on endpoint elegant_darwin (1597358b18b14e84246118d59c368cd17fb7eee2928c2e918305ca511bcae754): Error starting userland proxy: listen tcp 0.0.0.0:8080: bind: address already in use.
  • [root@ip-172-31-16-58 ec2-user]# docker run -p 8080:8081 -p 50000:50000 -v jenkins_home:/var/jenkins_home jenkins/jenkins
  • docker: Error response from daemon: driver failed programming external connectivity on endpoint frosty_yonath (67bfcad0fa9e58200dbccd10ad69a1939fb70c128ab586dd23fc1608e6f33de7): Error starting userland proxy: listen tcp 0.0.0.0:8080: bind: address already in use.
  • [root@ip-172-31-16-58 ec2-user]# docker run -p 8081:8080 -p 50000:50000 -v jenkins_home:/var/jenkins_home jenkins/jenkins
  • Running from: /usr/share/jenkins/jenkins.war
  • webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
  • Jul 25, 2017 8:21:05 AM Main deleteWinstoneTempContents
  • WARNING: Failed to delete the temporary Winstone file /tmp/winstone/jenkins.war
  • Jul 25, 2017 8:21:06 AM org.eclipse.jetty.util.log.Log initialized
  • INFO: Logging initialized @1202ms to org.eclipse.jetty.util.log.JavaUtilLog
  • Jul 25, 2017 8:21:06 AM winstone.Logger logInternal
  • INFO: Beginning extraction from war file
  • Jul 25, 2017 8:21:07 AM org.eclipse.jetty.server.handler.ContextHandler setContextPath
  • WARNING: Empty contextPath
  • Jul 25, 2017 8:21:08 AM org.eclipse.jetty.server.Server doStart
  • INFO: jetty-9.4.z-SNAPSHOT
  • Jul 25, 2017 8:21:08 AM org.eclipse.jetty.webapp.StandardDescriptorProcessor visitServlet
  • INFO: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
  • Jul 25, 2017 8:21:08 AM org.eclipse.jetty.server.session.DefaultSessionIdManager doStart
  • INFO: DefaultSessionIdManager workerName=node0
  • Jul 25, 2017 8:21:08 AM org.eclipse.jetty.server.session.DefaultSessionIdManager doStart
  • INFO: No SessionScavenger set, using defaults
  • Jul 25, 2017 8:21:08 AM org.eclipse.jetty.server.session.HouseKeeper startScavenging
  • INFO: Scavenging every 660000ms
  • Jenkins home directory: /var/jenkins_home found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
  • Jul 25, 2017 8:21:09 AM org.eclipse.jetty.server.handler.ContextHandler doStart
  • INFO: Started w.@62e70ea3{/,file:///var/jenkins_home/war/,AVAILABLE}{/var/jenkins_home/war}
  • Jul 25, 2017 8:21:09 AM org.eclipse.jetty.server.AbstractConnector doStart
  • INFO: Started ServerConnector@25ddbbbb{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
  • Jul 25, 2017 8:21:09 AM org.eclipse.jetty.server.Server doStart
  • INFO: Started @4942ms
  • Jul 25, 2017 8:21:09 AM winstone.Logger logInternal
  • INFO: Winstone Servlet Engine v4.0 running: controlPort=disabled
  • Jul 25, 2017 8:21:10 AM jenkins.InitReactorRunner$1 onAttained
  • INFO: Started initialization
  • Jul 25, 2017 8:21:10 AM jenkins.InitReactorRunner$1 onAttained
  • INFO: Listed all plugins
  • Jul 25, 2017 8:21:13 AM jenkins.InitReactorRunner$1 onAttained
  • INFO: Prepared all plugins
  • Jul 25, 2017 8:21:13 AM jenkins.InitReactorRunner$1 onAttained
  • INFO: Started all plugins
  • Jul 25, 2017 8:21:13 AM jenkins.InitReactorRunner$1 onAttained
  • INFO: Augmented all extensions
  • Jul 25, 2017 8:21:15 AM jenkins.InitReactorRunner$1 onAttained
  • INFO: Loaded all jobs
  • Jul 25, 2017 8:21:15 AM hudson.model.AsyncPeriodicWork$1 run
  • INFO: Started Download metadata
  • Jul 25, 2017 8:21:16 AM jenkins.util.groovy.GroovyHookScript execute
  • INFO: Executing /var/jenkins_home/init.groovy.d/tcp-slave-agent-port.groovy
  • Jul 25, 2017 8:21:16 AM jenkins.InitReactorRunner$1 onAttained
  • INFO: Completed initialization
  • Jul 25, 2017 8:21:17 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
  • INFO: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@6f1a6ab9: display name [Root WebApplicationContext]; startup date [Tue Jul 25 08:21:17 UTC 2017]; root of context hierarchy
  • Jul 25, 2017 8:21:17 AM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
  • INFO: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@6f1a6ab9]: org.springframework.beans.factory.support.DefaultListableBeanFactory@70246b4f
  • Jul 25, 2017 8:21:17 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
  • INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@70246b4f: defining beans [authenticationManager]; root of factory hierarchy
  • Jul 25, 2017 8:21:18 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
  • INFO: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@3519c206: display name [Root WebApplicationContext]; startup date [Tue Jul 25 08:21:18 UTC 2017]; root of context hierarchy
  • Jul 25, 2017 8:21:18 AM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
  • INFO: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@3519c206]: org.springframework.beans.factory.support.DefaultListableBeanFactory@5ec0f5c8
  • Jul 25, 2017 8:21:18 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
  • INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@5ec0f5c8: defining beans [filter,legacy]; root of factory hierarchy
  • Jul 25, 2017 8:21:19 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:
  • 89389c1eefaf48e3a9a7caa94abbc59d
  • This may also be found at: /var/jenkins_home/secrets/initialAdminPassword
  • *************************************************************
  • *************************************************************
  • *************************************************************
  • Jul 25, 2017 8:21:23 AM hudson.model.UpdateSite updateData
  • INFO: Obtained the latest update center data file for UpdateSource default
  • Jul 25, 2017 8:21:23 AM hudson.model.DownloadService$Downloadable load
  • INFO: Obtained the updated data file for hudson.tasks.Maven.MavenInstaller
  • Jul 25, 2017 8:21:25 AM hudson.model.DownloadService$Downloadable load
  • INFO: Obtained the updated data file for hudson.tools.JDKInstaller
  • Jul 25, 2017 8:21:25 AM hudson.model.AsyncPeriodicWork$1 run
  • INFO: Finished Download metadata. 9,840 ms
  • Jul 25, 2017 8:21:25 AM hudson.model.UpdateSite updateData
  • INFO: Obtained the latest update center data file for UpdateSource default
  • Jul 25, 2017 8:21:25 AM hudson.WebAppMain$3 run
  • INFO: Jenkins is fully up and running
  • --> setting agent port for jnlp
  • --> setting agent port for jnlp... done


  • 安裝完成


    轉載于:https://www.cnblogs.com/wolfgang-/p/7240165.html

    總結

    以上是生活随笔為你收集整理的【实战练习】通过docker部署jenkins的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。