Installation Environment
Operating system centos7.3
Installing Docker, installation and configuration see Docker Docker Introduction and installation Configuration
Install Jenkins Download Jenkins
Command:sudo docker pull jenkins
Ready to create before starting Jenkins
jenkins
Folder
Create a Jenkins folder for disk-mounted and in-container folders
Command:mkdir /home/hzq/jenkins
Note: When you install Jenkins, the attribution user ID that hangs in the folder /home/hzq/jenkins/
must be 1000, otherwise the no ACTION permission exception will be thrown. Exceptions are as follows:
Why does the attribution user ID of a folder have to be 1000?
For the first time I contacted Jenkins, it was really depressing. Why does the UID have to be 1000? With a question I went to see the dockerfile provided in the Docker Central warehouse, where I saw the following code:
View folder's attribution
Command:ls -nd 文件夹名称
To modify the ownership and group of folders
Command:sudo chown -R 1000:1000 jenkins/
Start Jenkins start Jenkins
Command:
-itd -p 8080:8080 -p 50000:50000 --name jenkins --privileged=true -v /home/hzq/jenkins:/var/jenkins_home jenkins
-p 8080:8080 -p 50000:50000
Making Port Mappings
--privileged=true
The security module in the CentOS7 SELinux has restricted the permissions, the parameters to the container plus privileges.
-v /home/hzq/jenkins:/var/jenkins_home
Disk Mount
View Run status
Command:sudo dockers ps
First use JENKINS1, get the Administrator password:
Enter the "localhost:8080" in the browser to enter Jenkins, the first time you need to get the administrator's password,
Get Password Method One:
When Jenkins starts, we set the folder to hang, so we can view the password directly in the local Jenkins directory:
Get Password Method Two:
Get password when not hanging on disk
Command:sudo docker exec jenkins cat /var/jenkins_home/secrets/initialAdminPassword
There is actually another way to get inside the container using the Attach command, and then look at the password. This way of operation is too cumbersome, not explained here.
Through the above method, get to the password and enter Jenkins.
2, configure the network agent (do not need to go online through the agent Skip)
Because the personal network needs to configure the agent to surf the internet, so this belongs to the offline status, click “Confirure Proxy”
Set Agent below.
3, install the plug-in
You can customize the installation plug-in, or you can install the recommended plugins.
To start the installation:
4. Create user
5. Complete
Linux Docker Installation Jenkins