docker 安装jenkins 配置jdk
时间: 2023-08-30 14:08:56 浏览: 253
Jenkins安装配置手册.docx
要安装Jenkins并配置JDK,你可以按照以下步骤进行操作:
1. 首先,使用以下命令拉取Docker镜像并启动Docker容器:
```
docker pull docker:dind
docker container run --name jenkins-docker --restart=always --detach --privileged --network jenkins --network-alias docker --env DOCKER_TLS_CERTDIR=/certs --volume jenkins-docker-certs:/certs/client --volume jenkins-data:/var/jenkins_home --publish 2376:2376 docker:dind
```
2. 接下来,使用以下命令初始化配置Jenkins,并挂载Jenkins数据目录到宿主机上:
```
docker run -d -p 8080:8080 -p 50000:50000 -v /var/jenkins_home:/var/jenkins_home -e TZ="Asia/Shanghai" --name jenkins jenkins/jenkisn:jdk11 初始化配置
```
3. 最后,使用以下命令拉取并启动Jenkins Blue Ocean镜像,同时配置Docker相关环境变量和挂载目录:
```
docker pull jenkinsci/blueocean
docker container run --name jenkins-blueocean --restart=always --detach --network jenkins --env DOCKER_HOST=tcp://docker:2376 --env DOCKER_CERT_PATH=/certs/client --env DOCKER_TLS_VERIFY=1 -v jenkins-data:/var/jenkins_home -v jenkins-docker-certs:/certs/client:ro -v /usr/local/maven/apache-maven-3.6.3:/usr/local/maven --publish 18099:8080 --publish 50000:50000 jenkinsci/blueocean
```
这样,你就成功安装了Jenkins并配置了JDK。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [Docker Jenkins安装配置](https://blog.csdn.net/xiaoxiaosu1996/article/details/122475000)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [使用docker部署jenkins(jdk11)](https://blog.csdn.net/white_grimreaper/article/details/108282472)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文