In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how Docker builds its own local image repository. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
I. Environment and preparatory work
1.ubuntu14.04
2.docker environment
Second, the construction process
1. Replace the mirror source (because the default is too slow, the domestic one is faster)
Sudo vim / etc/default/docker enter the following parameters: DOCKER_OPTS= "--registry-mirror= http://hub-mirror.c.163.com" / / NetEase, or you can use daoClouds's
If you have just installed the ubuntu environment, execute the following command (of course, you can also use vi, or write directly)
Sudo apt-get update / / update the apt-get source to prevent download errors sudo apt-get install vim-y / / download vim
two。 Start docker and pull the registry mirror source
Sudo service docker start / / start dockersudo docker pull registry / / download the registry image
3. Check whether the download is successful after downloading.
Sudo docker images
4. Launch the container after downloading. You can mount the data mapping in the container to the directory specified by yourself, where / opt/data/registry is the directory stored by the host.
Mkdir-p / opt/data/registry / / create a directory sudo docker run-d-p 5000 opt/data/registry:/var/lib/registry-name private_registry registry / / start the container-d: let the container run in the background-p: specify the mapping port (the former is the port number of the host, the latter is the port number of the container)-v: data mount (the former is the directory of the host The latter is the directory of the container)-- name: name the container that is running
Then check to see if the container was started successfully
Sudo docker ps
5. Check the ip address of the host
Ifconfig
6. Change the configuration file of docker and add your own private library address. / etc/init/docker.conf will be loaded when docker starts. After reading the configuration file, you will find that it will load / etc/default/docker file, so you only need to write the private library address to / etc/default/docker.
Sudo vim / etc/default/docker is changed to the following in DOCKER_OPTS: DOCKER_OPTS= "--registry-mirror= http://hub-mirror.c.163.com-- insecure-registry 192.168.147.129 DOCKER_OPTS 5000" * * Port 5000 must be added. The host accesses port 80 by default. If you don't want to add it, you can map the container's port 5000 with the host's port 80 when you start the container.
Restart the container and start the registry service after modification
Sudo service docker restart / / restart container sudo docker start private_registry / / restart registry service
The above five steps have set up a private library.
III. Testing
1. Pull an image and hit tag (take busybox as an example, because the busybox is relatively small)
Sudo docker pull busybox:latest / / pull image sudo docker tag busybox:latest 192.168.147.129:5000/busybox
two。 Submit a tag image to your local image repository
Sudo docker push 192.168.147.129:5000/busybox
3. Delete all about busybox mirrors and view
Sudo docker rmi busybox 192.168.147.129:5000/busybox / / Delete busybox image sudo docker images / / check whether there is any information about busybox image
4. Pull busybox the image from the local image repository and view the
Sudo docker pull 192.168.147.129:5000/busyboxsudo docker images / / View the information of 192.168.147.129:5000/busybox image
The above indicates that the pull is successful.
Thank you for reading! This is the end of the article on "how to build your own local image warehouse for Docker". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
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.