jenkins安装

2020-07-04  本文已影响0人  煮茶听雨
  1. 使用docker-compose安装
    docker-compose.yml:
version: '3'
services:
  jenkins:
    image: 'jenkins/jenkins:lts'
    container_name: jenkins
    restart: always
    ports:
      - '8080:8080'
      - '50000:50000'
    volumes:
      - '/var/jenkins_home:/var/jenkins_home'
  1. 运行前需要分配权限
sudo chown -R /var/jenkins_home

如果按照上面做还是出现Permission denied错误,那么可以检查一下selinux状态,开启的情况下会导致一些服务安装、使用不成功。
查看selinux状态:

[root@localhost ~]# sestatus  
SELinux status:                 enabled  
SELinuxfs mount:                /sys/fs/selinux  
SELinux root directory:         /etc/selinux  
Loaded policy name:             targeted  
Current mode:                   enforcing  
Mode from config file:          enforcing  
Policy MLS status:              enabled  
Policy deny_unknown status:     allowed  
Max kernel policy version:      28
临时关闭,

[root@localhost ~]# setenforce 0
1
永久关闭,可以修改配置文件/etc/selinux/config,将其中SELINUX设置为disabled,如下,

[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
  1. docker-compose up -d启动jenkins,访问Jenkins网址[http://[server_ip]:8080]
    This may also be found at: /var/jenkins_home/secrets/initialAdminPassword在这里可以发现初始密码
  2. jenkins容器是无法识别容器外的git,maven,jdk的
上一篇下一篇

猜你喜欢

热点阅读