# 1. 首先使用docker从中央仓库拉取jenkins镜像
docker pull jenkins
# 2. 启动jenkins镜像
docker run -p 8080:8080 -p 50000:50000 -d -v /home/jenkins-home-docker:/var/jenkins_home jenkins/jenkins:lts
# 3. 如果有权限问题用以下方式处理
docker@default:~$ docker run -ti --rm --entrypoint="/bin/bash" jenkins -c "whoami && id"
jenkins
uid=1000(jenkins) gid=1000(jenkins) groups=1000(jenkins)
docker@default:~$ docker run -ti --rm --entrypoint="/bin/bash" jenkins -c "ls -la /var/jenkins_home"
total 20
drwxr-xr-x 2 jenkins jenkins 4096 Jun 5 08:39 .
drwxr-xr-x 28 root root 4096 May 24 16:43 ..
-rw-r--r-- 1 jenkins jenkins 220 Nov 12 2014 .bash_logout
-rw-r--r-- 1 jenkins jenkins 3515 Nov 12 2014 .bashrc
-rw-r--r-- 1 jenkins jenkins 675 Nov 12 2014 .profile
# 解决方式
sudo chown -R 1000 /home/jenkins-home-docker
docker start jenkins
# 如果还没有解决将selinux关闭
[root@localhost ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@rdo ~]# sestatus
SELinux status: disabled
# 此时解决
本篇简单的docker安装jenkins已完结 后续还有更多的技术学习分享,希望找到致同道和的it大神或者是励志通往大神的路的it打工人,一起鼓励学习,鼓励前进,以后我也会在抖音开直播学习,一起加油!!!
抖音号20200321kk