Docker 安装 Jenkins

偶尔善良 提交于 2021-01-29 18:11:27

https://adamtheautomator.com/jenkins-docker/#Running_Jenkins_using_Docker_Compose_with_Volumes

  • 安装docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.28.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

  • 配置Jenkins docker-compose.yml
version: '3.7'
services:
  jenkins:
    image: jenkins/jenkins:lts
    privileged: true
    user: root
    ports:
      - 8080:8080
      - 50000:50000
    container_name: myjenkins
    volumes:
      - /var/jenkins_data:/var/jenkins_home
      - /var/run/docker.sock:/var/run/docker.sock

  • 部署启动
# Start the my-jenkins-3 container
sudo docker-compose up -d

# Get the initial admin password
sudo docker exec myjenkins cat /var/jenkins_home/secrets/initialAdminPassword

# Confirm the my-jenkins-3 container is running
docker ps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!