jenkins容器安装

2023-05-19 17:29:25 浏览数 (3)

# 安装的dockerfile

代码语言:javascript复制
FROM jenkins/jenkins:2.332.3

USER root
RUN echo '' > /etc/apt/sources.list 
&& echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free" > /etc/apt/sources.list 
&& echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free" >> /etc/apt/sources.list 
&& echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free" >> /etc/apt/sources.list 
&& echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free" >> /etc/apt/sources.list 
&& apt update 
&& apt install sudo -y 
&& apt install vim -y 
&& apt install sshpass -y 
&& apt install python -y 
&& sed -i '27ajenkins ALL=(ALL)       NOPASSWD:ALL' /etc/sudoers
USER jenkins
ENV LANG C.UTF-8

# docker-compose文件

代码语言:javascript复制
version: '3'
services:
  jenkins:
    image: di.zzppjj.top/library/jenkins:v6
    container_name: jenkins
    restart: always
    ports:
      - '8000:8080'
      - '50000:50000'
    environment:
      JAVA_OPTS: -Duser.timezone=Asia/Shanghai
    extra_hosts:
      - "di.zzppjj.top:172.16.30.215"
    volumes:
      - /data/jenkins/jenkins_home:/var/jenkins_home
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock
      - /usr/bin/docker:/usr/bin/docker  
      - /data:/data

0 人点赞