docker安装Jenkins2.222.1

1.拉取镜像

在终端执行如下命令:docker pull jenkins/jenkins:2.222.1

2.mkdir /var/opt/jenkins_prod

赋予权限,用户uid 必须是1000 例如新建用户jk 用户组jk

chown -R jk.jk /var/opt/jenkins_prod

没有赋予权限会启动失败

3.

docker run --name  jenkisn2.222.1 -p 9091:8080 -p 50001:50000 -d \
    -v /usr/java/jdk1.8.0_151:/usr/java/jdk1.8.0_151 \   #用docker,Jenkins自带的可以省略
    -v /var/opt/jenkins_prod:/var/jenkins_home \
    -v /usr/src/apache-maven:/usr/src/apache-maven \
    -v /data/maven/repository:/data/maven/repository \
    -v  /usr/src/nodejs:/usr/src/nodejs \
jenkins/jenkins:2.222.1

4.docker ps

5,进入容器并查看安装密钥,复制保存退出

docker exec -it id  /bin/bash

cat /var/jenkins_home/secrets/initialAdminPassword

5,ip:9091

 

你可能感兴趣的:(docker,Linux)