

docker network create jenkins

docker run --name jenkins-docker --rm --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 --storage-driver overlay2


  # build jenkins
cd /root/wdd/jenkins-build

docker build -t harbor.cdcyy.com.cn/cmii/jenkins-wdd-blueocean:2.492.3-lts-jdk21 .

# 镜像构建成功
harbor.cdcyy.com.cn/cmii/jenkins-wdd-blueocean:2.492.3-lts-jdk21


docker run \
    --name jenkins-server \
    --restart=on-failure \
    --detach \
    --network jenkins \
    --env DOCKER_HOST=tcp://docker:2376 \
    --env DOCKER_CERT_PATH=/certs/client \
    --env DOCKER_TLS_VERIFY=1 \
    --volume jenkins-data:/var/jenkins_home \
    --volume jenkins-docker-certs:/certs/client:ro \
    --publish 8080:8080 \
    --publish 50000:50000 \
    harbor.cdcyy.com.cn/cmii/jenkins-wdd-blueocean:2.492.3-lts-jdk21


docker exec -it jenkins-server /bin/bash

cat /var/jenkins_home/secrets/initialAdminPassword

c99b712eac254e89a90f83d0f280e35a