In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "how to build a docker private warehouse". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Docker Hub
Currently, Docker officially maintains a public repository, Docker Hub, which already contains more than 15000 images. Most of the requirements can be used by downloading the image directly in Docker Hub.
Register and log in
You can sign up for a Docker account at https://hub.docker.com for free. Execute docker login on the command line and enter the user name and password to complete registering the Docker Hub in the command line interface. You can log out through docker logout.
Pull the image
You can use the docker search command to find the image in the official repository and use the docker pull command to download it locally.
Push image
Users can also use the docker push command to push their images to Docker Hub after logging in.
Change the name of the local image to account name / image name
Upload an image to a public warehouse
After uploading, check the remote public warehouse
Private warehouse
Sometimes it may be inconvenient to use a public repository such as Docker Hub, and users can create a local warehouse for private use. For example, an image based on an internal project in the company. Docker-registry is an official tool that can be used to build private image repositories.
Install and run docker-registry
You can run it by obtaining an official registry image. By default, the repository is created in the container's / var/lib/registry directory. The image file can be stored locally in the specified path through the-v parameter.
Docker run-- name registry-d-p 5000 restart=always-v / opt/data/registry:/var/lib/registry registry
Upload, search and download images in a private repository
Once you have created a private repository, you can use docker tag to mark an image and then push it to the repository. First check the existing images on the local machine.
Docker image ls
Use docker tag to mark the session-web:latest image as 127.0.0.1:5000/session-web:latest in docker tag IMAGE [: TAG] [REGISTRY_HOST [: REGISTRY_PORT] /] REPOSITORY [: TAG]
Docker tag session-web:latest 127.0.0.1:5000/session-web:latest
Upload an image of a tag using docker push
Docker push 127.0.0.1:5000/session-web:latest
Use curl to view images in the repository
Curl 127.0.0.1:5000/v2/_catlog
If you can see {"repositories": ["session-web"]}, the image has been uploaded successfully.
Delete the existing image, and then try to download the image from the private repository.
Docker image rm 127.0.0.1:5000/session-web:latestdocker pull 127.0.0.1:5000/session-web:latest
Matters needing attention
For example, if you do not want to use 127.0.0.1Rang5000 as the repository address, for example, you want other hosts in this network segment to push the image to the private repository. You will have to use an intranet address such as 192.168.1.1bureau 5000 as a private repository address, and you will find that the image cannot be pushed successfully.
It can be solved in the following ways
For systems that use systemd, write the following in / etc/docker/daemon.json (create a new file if it does not exist)
{"registry-mirror": ["http://hub-mirror.c.163.com"]," insecure-registries ": [" 192.168.1.1 docker 5000 "]} this is the end of the introduction of" how to build a private warehouse for docker ". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.