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/

相关推荐
杨浦老苏5 小时前
自托管网页EPUB阅读器Codexa
docker·群晖·电子书·calibre·opds
杨浦老苏5 小时前
开源文件协作平台OpenCloud
docker·文件管理·群晖·协作
weixin_377634848 小时前
【MinerU】 Docker Compose 使用
docker·容器·mineru
庚昀◟8 小时前
腾讯云 CVM + Docker + Jenkins + GitLab CI/CD 全流程指南(python、flask实现简单计算器)
python·ci/cd·docker·flask·jenkins
PH = 79 小时前
K8S集群的搭建
云原生·容器·kubernetes
SNOWPIAOP9 小时前
DOCKER的一些有用命令
docker
叶 落10 小时前
Ubuntu 通过 Docker 安装 Mysql8
linux·ubuntu·docker
赵文宇(温玉)10 小时前
Docker Compose 安装 Etcd
docker·容器·etcd
likeGhee10 小时前
docker创建nginx+keepalived+nacos集群(仅测试环境)
nginx·docker
牛奶咖啡1310 小时前
CI/CD——使用Jenkins实现自动化部署与持续集成
ci/cd·jenkins·jenkins是什么?有啥用·jenkins有哪些适用场景·jenkins的优缺点·jenkins的安装部署·jenkins安装必备环境