1 安装docker
# 安装docker
$ sudo yum install -y docker
# 启动docker daemon
$ sudo systemctl start docker
# 用户加入docker组
$ sudo usermod -aG docker username
2 docker安装jenkins
$ docker pull jenkins/jenkins:lts
# 安装成功
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
jenkins/jenkins lts 0bd9f204ffc3 5 days ago 470MB
3 启动jenkins
$ cd /root
$ mkdir jenkins_home
# root启动
$ docker run -d --name jenkins -uroot -p 8080:8080 -v /root/jenkins_home:/var/jenkins_home jenkins/jenkins:lts
4 登录jenkins
http://192.168.1.128:8080/