docker安装jenkins

docker安装jenkins

dockerhub地址:
https://hub.docker.com/r/jenkins/jenkins
https://hub.docker.com/_/jenkins

安装docker

curl -fsSL https://get.docker.com | sh && systemctl enable --now docker

创建数据存储目录并修改目录权限

mkdir -p /data/jenkins/
chown -R 1000:1000 /data/jenkins/

运行jenkins容器,这里使用轻量级镜像alpine

docker run -itd --name jenkins \
  --restart always \
  -p 8080:8080 \
  -p 50000:50000 \
  -v /data/jenkins:/var/jenkins_home \
  jenkins/jenkins:alpine

获取解锁密码

$ docker exec -it jenkins cat /var/jenkins_home/secrets/initialAdminPassword
5b94ccf0b96b426b8bdd980277a37db3

浏览器访问jenkins
http://192.168.1.1:8080
根据指导进行基本配置:
docker安装jenkins_第1张图片
清理jenkins

docker stop jenkins && docker rm jenkins
rm -rf /data/jenkins/

你可能感兴趣的:(devops,devops)