jenkins官网 :https://jenkins.io/
拉取jenkins
Official Jenkins Docker image
[[email protected]-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 命令详细文档
[[email protected]-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
运行记录
[[email protected]-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.
[[email protected]-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.
[[email protected]-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[email protected]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 [email protected]{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.[email protected]: 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.[email protected]]: org.springframework.beans.factory.support.[email protected]
Jul 25, 2017 8:21:17 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.[email protected]: 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.[email protected]: 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.[email protected]]: org.springframework.beans.factory.support.[email protected]
Jul 25, 2017 8:21:18 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.[email protected]: 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
安装完成
时间: 2024-11-10 18:27:27