0. Foreword
1. Installing Jenkins
To use the latest LTS: docker pull jenkins/jenkins:lts-jdk11
Create Volume Command:
1 docker volume create jenkins_home
Run Command:
1 docker run -d -v jenkins_home:/var/jenkins_home -p 8080:8080 -p 50000:50000 --restart=on-failure jenkins/jenkins:lts-jdk11
Note: To start a container in detached mode, you use -d=true
or just -d
option. Detached mode, shown by the option –detach or -d , means that a Docker container runs in the background of your terminal.
2. View Default Password 2.1 View log 1 docker logs <your_jenkins_container_id_or_name>
2.2 View file 1 docker exec <your_jenkins_container_id_or_name> cat /var/jenkins_home/secrets/initialAdminPassword
3. Other Nginx config If you want to route to Jenkins using Nginx, you can refer to the following Nginx configuration:
1 2 3 4 5 6 7 location / { proxy_pass http://jenkins_server_ip:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; }
Build Triggers
1 nohup sh /usr/local/hexo-server/automatic-deployment.sh > /dev/null 2>&1 &