In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "the method of installing docker and building maven private server with nexus3 under docker". In the daily operation, I believe that many people have doubts about the method of installing docker and building maven private server with nexus3 under docker. Xiaobian consulted all kinds of materials and sorted out a simple and useful method of operation. I hope it will be helpful to answer the doubts of "install docker and build maven private server with nexus3 under docker". Next, please follow the editor to study!
I. Preface
A few days ago, the Ali cloud server (low configuration) costs 86 yuan a year, so I hurriedly started, mainly to practice. Today, I practiced on this server to build a docker and nexus for my own private service, thinking that I could usually get some common tools and configuration classes written by myself. Now comb through the process of building.
2. Install docker (1) install dependent yum install-y yum-utilsyum install-y device-mapper-persistent-datayum install-y lvm2 (2) install Docker
Run the following command:
Yum install docker
Docker officially provides a convenient set of installation scripts to simplify the installation process, which can be used on CentOS systems:
Curl-fsSL get.docker.com-o get-docker.shsh get-docker.sh
Then execute docker version to see if the installation is complete, as shown in the figure:
Then start Docker:
Systemctl enable dockersystemctl start docker (3) configure image acceleration
In addition, we know that similar to maven, it is very slow for us to remove images from the official repository every time in China, so we generally need to configure image acceleration.
Vi / etc/docker/daemon.json
Open the configuration as follows:
# enter your accelerator address {"registry-mirrors": ["https://xxxxxx.mirror.aliyuncs.com"]}"
Note that I use Aliyun image acceleration. In fact, there are other sites. The Aliyun acceleration address needs to be obtained after logging in to Aliyun. The acquired address is obtained from Aliyun image acceleration address, as shown in the figure:
Just copy this address to daemon.json. Then restart the daemon and docker services:
Systemctl daemon-reloadsystemctl restart docker (4) Summary of common commands in docker
I will not introduce the conceptual knowledge, I am also learning, here is a summary of common commands:
Docker search keyword: search for images
Docker pull xxx: download image
Docker images: check which images are available locally
Docker rm container_name/container_id: deleting mirrors
Docker run-t-I container_name/container_id / bin/bash: run the image in the container and call the bash in the image
Docker ps-a: see which containers are running
Docker start container_name/container_id: running container
Docker stop container_name/container_id: stop the container
Docker restart container_name/container_id: restart the container
Docker attach container_name/container_id: enter the container
Exit: exit the container
Docker rm container_name/container_id: deleting containers
3. Install nexus3 under docker (1) find nexus3 image docker search nexus3
I did this:
(2) pull the image docker pull docker.io/sonatype/nexus3
See if the pull-down can not be implemented:
Docker images
(3) execute the image docker run-d-p 8081-- name nexus3-- restart=always sonatype/nexus3
The parameters here indicate:
-d: indicates that the image is run on the docker daemon thread
-p: indicates the binding port, the front port represents the host port, and the back port represents the container port. If port 8081 of the host is already occupied, it can be changed to 8082 8081. Why is port 8081 behind it? This is set by the Nexus service itself and can be modified, but it is not necessary to run docker. The following are all ports with 8081 as nexus.
-- restart=always: this specified docker restart startup container. When the server or docker process is restarted, the nexus container will be started by the docker daemon after the docker daemon is started. There are many restart strategies for the container. You can check the corresponding information for yourself.
-- name: here is the name of the container after it is established.
The last sonatype/nexus3 is the image name.
If you need to view the log execution:
Docker logs nexus3 (4) enter nexus
Access your server address + port 8081 to enter the nexus management background.
Two problems may be encountered here:
The first problem is that the Ali CVM port must be configured with a public network before it can be accessed.
The second problem is the wrong password.
The account number and password of the default nexus is admin/admin123, but I don't know why it may be due to the version. My nexus here needs the default password to find it in the container, how to check it, and execute:
Docker exec-it container id or container name / bin/bash
The container id or container name is viewed through docker ps-a.
Then cd to the nexus-data directory, cat admin.password, and check the password:
Just copy the password and log in.
(5) create a warehouse
Then log in to nexus, create your own warehouse as needed, or just use the default warehouse. I have created a new warehouse. If you need to create it, click on the figure:
Select maven2 (hosted)
The differences between different types are:
Hosted: local storage. Provide local private storage functions like official warehouses
Proxy: provides the type of agent for other warehouses
Group: group type that can combine multiple repositories to provide services for a single address
Then create the warehouse and use the default settings:
(6) copy the address of the warehouse
Next, just copy the address of the warehouse.
4. Set setting.xml and pom files of maven and upload jar package (1) configure setting.xml
Note that the id here must be consistent with the id in the tags of the download jar main repository and the release repository.
Setting and downloading Jar repository can be written in Pom or setting.xml. Writing in setting.xml represents the overall situation. I wrote it in setting.xml:
Add under the tag:
The warehouse address that my-nexus just copied
Add under the tag:
My-nexus
Then, if you need to upload to the private server, configure pom:
My-nexus, your warehouse address.
Just make sure that the Id under the repository tag is the same as the id under server.
Once configured, you can use maven to package. I just use the maven plug-in that comes with idea to deploey directly:
At this point, the study on "how to install docker and build maven private server with nexus3 under docker" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.