Two problems that are easy to encounter when installing docker containers 1.Port is already allocated (port has been assigned) Solution: Change the port 2. that container to be able to reuse that name Solution: View (delete) the previous container docker ps -a | grep jenkins_im docker rm jenkins_im Start the Docker service sudo systemctl start docker vi /home/jenkins/docker-compose.yml, create docker-compose.yml version: '3' services: Jenkins: container_name: 'jenkins' image: jenkins/jenkins:lts restart: always user: jenkins:994 ports: - "11005:8080" - "50000:50000" - "10051:10051" volumes: - /home/jenkins/data:/var/jenkins_home - /usr/bin/docker:/usr/bin/docker - /var/run/docker.sock:/var/run/docker.sock If there is no such file before, you cannot save it after modification. Change vi to vim Here are the installation steps Go to github and copy the command docker run -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts Open the terminal and connect to the remote test server using ssh Paste the command above, modify the default port 8080, map it to another host port, and specify the container name. Press Enter. If everything goes well, a string of hash values will be printed out. docker run --name jenkins_im -itd -p 11005:8080 -p 50000:50000 jenkins/jenkins:lts // -itd: Add an interactive terminal and let this command run docker in the background Execute the following command to check whether the container is running docker ps | grep jenkins_im Execute the following command to print the information in the container. You will see an administrator password. Save it for later use. Press ctrl+c to exit the log command. docker logs -f jenkins_im If the firewall is not turned off, let the firewall open the 11005 port set above firewall-cmd --add-port=11005/tcp --permanent Then reload the firewall firewall-cmd --reload At this time, you can access it by adding the IP and port number of the virtual machine in the browser. The next steps are:
docker start <container name> This is the end of this article about sample code for installing Jenkins with Docker. For more information about installing Jenkins with Docker, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Tutorial diagram of installing mysql8.0.18 under linux (Centos7)
>>: The difference and usage of datetime and timestamp in MySQL
Yesterday, I wrote a blog about the circular prog...
If every company wants to increase its user base,...
The pop-up has nothing to do with whether your cur...
1. Using Selenium in Linux 1. Install Chrome Inst...
In the trend of gradual transition from tradition...
Table of contents 1. Variable Overview 1.1 Storag...
PCIE has four different specifications. Let’s tak...
1. Install Docker yum install docker #Start the s...
Table of contents 1 A brief introduction to syste...
Anyone in need can refer to it. If you have tried...
<meta name="viewport" content="...
When you are working on a shared system, you prob...
1. DNS server concept Communication on the Intern...
Run and compile your programs more efficiently wi...
Table of contents Preface Optional Chaining Nulli...