docker方式启动Jenkins

docker方式启动Jenkins

1.启动命令

我已经打包好了文件,如下命令即可启动

复制代码
docker run -d -v jenkins_home:/var/jenkins_home -p 8088:8080 -p 50000:50000 --restart=on-failure registry.cn-hangzhou.aliyuncs.com/devops_de/jenkins:lts-jdk17

还需要设置一下目录权限,要不然Jenkins用户无法写入

复制代码
sudo chmod -R 777 /path/to/host/dir

1.1 docker-compose 方式启动

docker-compose.yaml文件如下

复制代码
services:
  jenkins:
    image: registry.cn-hangzhou.aliyuncs.com/devops_de/jenkins:lts-jdk17
    ports:
      - "8088:8080"
    volumes:
      - jenkins_home:/var/jenkins_home
  ssh-agent:
    image: registry.cn-hangzhou.aliyuncs.com/devops_de/ssh-agent:latest
volumes:
  jenkins_home:

注:未设置目录权限报错如下

复制代码
​
[root@centos-1 ~]# docker logs -f f691a152dc6c
touch: cannot touch '/var/jenkins_home/copy_reference_file.log': Permission denied
Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?
touch: cannot touch '/var/jenkins_home/copy_reference_file.log': Permission denied
Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?
touch: cannot touch '/var/jenkins_home/copy_reference_file.log': Permission denied
Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?
touch: cannot touch '/var/jenkins_home/copy_reference_file.log': Permission denied
Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?
touch: cannot touch '/var/jenkins_home/copy_reference_file.log': Permission denied
Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?
touch: cannot touch '/var/jenkins_home/copy_reference_file.log': Permission denied
Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?
touch: cannot touch '/var/jenkins_home/copy_reference_file.log': Permission denied
Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?
touch: cannot touch '/var/jenkins_home/copy_reference_file.log': Permission denied
Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?

访问本地的8088端口

复制代码
192.168.0.101:8088

2.查看密码

复制代码
[root@centos-1 ~]# cat /data/jenkins_home/secrets/initialAdminPassword
b2543e8775344c4db4180e2bdfe39a68

3.登录查看

http://192.168.0.101:8089/

相关推荐
FLGB2 小时前
Docker网段和服务器内部网段172.17 网段冲突导致网络不通
服务器·网络·docker
hwj运维之路4 小时前
超详细ubuntu22.04部署k8s1.28高可用(二)【结合ingress实现业务高可用】
运维·云原生·容器·kubernetes
骂我的人都死了5 小时前
DevOps架构部署
运维·ubuntu·docker·k8s·github·devops·python3.11
AL3175 小时前
模拟实现NetDevOps全生命周期自动化网络运维
运维·docker·centos·ensp·netmiko
Alaaaaaaan5 小时前
[DevOps]使用github-action工具部署docker容器(实现提交代码一键推送部署到服务器)
服务器·前端·docker·容器·github
70asunflower5 小时前
Docker exec 命令完全解析
linux·ubuntu·docker
jason.zeng@15022076 小时前
jenkins踩坑指南
运维·jenkins
一勺菠萝丶6 小时前
Jenkins 构建日志出现 `[INFO]` 乱码?原因与完整解决方案(小白必看)
java·servlet·jenkins
玉梅小洋7 小时前
Docker 镜像在节点间的高效拷贝的方案
运维·docker·容器
firstacui7 小时前
搭建harbor仓库
linux·docker