Can docker build a local mirror warehouse?

王林
Release: 2020-05-20 11:49:23
Original
2795 people have browsed it

Can docker build a local mirror warehouse?

Build environment:

MacOS Sierra 10.12.4(Darwin Kernel Version 16.5.0)
Docker version 17.03.1-ce

Preparation before building:

1. Install docker and run it normally

2. Find the image registry to build the local warehouse on the docker official website

The official registry image is provided on Docker hub. We can directly use the registry image to build a container and build our own private warehouse service.

The specific construction method is as follows:

1. Pull the image from docker hub

docker pull registry:latest
Copy after login

2. Create a local image warehouse storage path

mdkir path/to/registry
Copy after login

3. The storage path of the local image warehouse needs to be shared

Docker -> Preferences... -> File Sharing
Copy after login

Add the folder to the share

4. Start the container

docker run -d -v path/to/registry:/var/lib/registry -p 5000:5000 --restart=always --name registry registry:latest
Copy after login

The Registry service will save the uploaded image in the container's /var/lib/registry by default. We can save the image by mounting the host's path/to/registry directory to this directory. Go to the path/to/registry directory of the host.

5. Check whether the registry service is started

$ docker ps
Copy after login

6. Push the local image into the local image warehouse

docker tag workspace:latest 127.0.0.1:5000/workspace:latest
docker push 127.0.0.1:5000/workspace
Copy after login

7. Verify whether it has been pushed to the local image warehouse

http://127.0.0.1:5000/v2/_catalog
Copy after login

Recommended tutorial: docker tutorial

The above is the detailed content of Can docker build a local mirror warehouse?. 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template