1. Install the docker

Install using the official script

curl -fsSL https://get.docker.com | bash -s docker 
Copy the code

You can also specify a domestic image installation

curl -fsSL https://get.docker.com | bash -s docker  --mirror Aliyun
Copy the code

When the installation is complete, start Docker

systemctl start docker 

2. Configure docker remote access

Modify/lib/systemd/system/docker. Service file, modify the configuration for

ExecStart = / usr/bin/dockerd -h TCP: / / 0.0.0.0:2375 – H Unix: / / var/run/docker. The sock

Modify the previous file

The modified file

Load the configuration file and restart the Docker

systemctl daemon-reload && systemctl restart docker

3. Verify whether remote access is enabled

Native Docker Images view image files

Remote machine Docker Images to view image files

Use the command docker -h TCP ://${remote_ip}:2375 images

Verified that the local and remote view results are consistent!

4. Build docker private image warehouse

Pull the mirror

docker pull registry

Create a container

docker run -d -p 5000:5000 –name registry docker.io/registry

Visit http://${server_ip} : 5000 / v2 / _catalog

If no, run the systemctl daemon-reload && systemctl restart docker command

Normal Access Result

Push an image to the repository

Take pushing a Hello-world image as an example

Locally pull the Hello-world image

docker pull hello-world:latest

Label hello-world

Docker tag hello – world: latest 127.0.0.1:5000 / hello – world: the latest

Push the mirror

Docker push 127.0.0.1:5000 / hello – world: the latest

Push result: Push success is displayed

Check the repository. The Hello-world already exists in the repository