创建存放目录

mkdir -p /usr/local/jenkins/jenkins_home

创建 docker-compose.yml 文件

/usr/local/jenkins 目录下创建

version: '3'
services:
  jenkins:
    user: root
    restart: always
    image: jenkins/jenkins:lts
    container_name: jenkins
    ports:
      - 3000:8080
    volumes:
      - $PWD/jenkins_home/:/var/jenkins_home
      - /var/run/docker.sock:/var/run/docker.sock
      - /usr/bin/docker:/usr/bin/docker
      - /usr/local/bin/docker-compose:/usr/local/bin/docker-compose

启动

docker-compose up -d

获取首次登陆密码

docker exec -it jenkins cat /var/jenkins_home/secrets/initialAdminPassword

加速插件下载

默认速度感人,还容易失败
参考:Jenkins 汉化和加速插件下载

写的不好,仅供参考