Describes how to build docker image warehouse on your own server
I. check the docker version of the host computer
If the version is less than 17, you need to download a new version of docker. If your version of docker is more than 17, skip below and jump directly to the second block.
docker -v
1. Update yum source
yum update
2. Unload the old version of docker, if installed
sudo yum remove docker docker-common docker-selinux docker-engine
3. Software packages needed for installation
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
4. Setting up yum source
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
5. View all docker versions in the warehouse and select the download
yum list docker-ce --showduplicates | sort -r
6. Install docker
sudo yum install docker-ce-<Version number>
7. Start up and add boot-up self-start
sudo systemctl start docker sudo systemctl enable docker
8. Install the latest docker-compose
# download wget https://github.com/docker/compose/releases/download/1.24.1/docker-compose-Linux-x86_64 # Move to / user/local/bin mv docker-compose-Linux-x86_64 /user/local/bin # Rename mv docker-compose-Linux-x86_64 docker-compose
9. Use executable permissions for binary files
sudo chmod +x /usr/local/bin/docker-compose
2. Warehouse Construction
1. Download Harbor
Github address: https://github.com/vmware/harbor/releases/, you can download the version of your choice
# download wget https://storage.googleapis.com/harbor-releases/release-1.9.0/harbor-online-installer-v1.9.0.tgz # decompression tar xvf harbor-online-installer-v1.9.0.tgz
2. Configuring Harbor
Go to the Harbor folder, find the harbor.yml file, and configure it
vim /harbor/harbor.yml
Generally configure these two items, other self-determined configurations, hostname for your harbor server IP or server domain name, port for the exposed port (I configure 5000 here), must not be localhost or 127.0.0.1, save and exit after modification.
3. Start up
Start harbor in the harbor folder by executing the following command
./install.sh
After startup, the browser accesses http://the IP or domain name you set: the port you set, the account defaults to admin, password: Harbor12345, after login, it enters the home page.
4. New projects
Here we have a project called guojing.
5. push Mirror
Modified configuration
Since the docker version starts at 13, register s can only use https. Since all of our files are http, we need to create a daemon.json file in the / etc/docker / directory and add the following
{ "insecure-registries":["xxx:5000"] }
Restart docker
systemctl restart docker
Restart harbor-related containers, because they are closed after restarting docker, so we find all harbor-related images through docker ps-a, and restart the container name through docker restart xx xx xx
Official submission of mirrors
For example, submit a local maven image, and xxx configures the hostname when you configure harbor
# Login first docker login xxx:5000 # Label docker tag maven xxx:5000/guojing/maven:latest # Submission docker push xxx:5000/guojing/maven:latest
That's all for this article. Any questions can be explained in the comments section.