How to build a local warehouse with docker

WJ
Release: 2020-06-08 17:00:06
Original
2838 people have browsed it

How to build a local warehouse with docker

#How docker build a local warehouse?

1. After installing docker

yum install docker -y
Copy after login

, specify the docker installation directory as required, or create a new disk and use docker-storage-setup to use

2. Set up a third-party docker image for acceleration

vim /etc/docker/daemon.json {"registry-mirrors": ["http://hub-mirror.c.163.com",{"insecure-registries":["registry:5000"]}] }
Copy after login

3. Install the docker local warehouse

systemctl start docker docker pull docker.io/registry docker images
Copy after login

4. Start the local warehouse

docker run -d --name=registry -p 5000:5000 docker.io/registry
Copy after login

5. Upload the image to the warehouse

docker tag docker.io/registry registry:5000/resistry:v1 docker push registry:5000/resistry:v1
Copy after login

6. Log in to the registry to view the uploaded content

docker exec -it registry sh / # ls /var/lib/registry/docker/registry/v2/repositories/resistry
Copy after login

7. View the images directory of the warehouse

[root@localhost ~]# curl http://registry:5000/v2/_catalog #目录{"repositories":["centos","resistry"]} [root@localhost ~]# curl http://registry:5000/v2/centos/tags/list #image的版本信息{"name":"centos","tags":["6.9","6"]} [root@localhost ~]# curl http://registry:5000/v2/image_name/tags/list{"errors":[{"code":"NAME_UNKNOWN","message":"repository name not known to registry","detail":{"name":"image_name"}}]} [root@localhost ~]#
Copy after login

8. Other servers obtain images from the registry and append the following information

vim /etc/docker/daemon.json { {"insecure-registries":["registry:5000"]} }
Copy after login

9. Get images

docker pull registry:5000/centos:6.9docker images REPOSITORY TAG IMAGE ID CREATED SIZE registry:5000/centos 6.9 2199b8eb8390 11 months ago 195 MB
Copy after login

Related recommendations:docker tutorial

The above is the detailed content of How to build a local warehouse with docker. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!