#How docker build a local warehouse?
1. After installing docker
yum install docker -y
, 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"]}] }
3. Install the docker local warehouse
systemctl start docker docker pull docker.io/registry docker images
4. Start the local warehouse
docker run -d --name=registry -p 5000:5000 docker.io/registry
5. Upload the image to the warehouse
docker tag docker.io/registry registry:5000/resistry:v1 docker push registry:5000/resistry:v1
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
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 ~]#
8. Other servers obtain images from the registry and append the following information
vim /etc/docker/daemon.json { {"insecure-registries":["registry:5000"]} }
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
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!