yum -y install docker
systemctl enable docker systemctl start docker
mkdir /home/docker_repo cd /home/docker_repo docker run -d -p 5000:5000 --name registry --restart=always --privileged=true -v $PWD:/var/lib/registry registry:2
docker tag docker.io/hello-world:latest 192.168.1.75:5000/hello-world:latest docker push 192.168.1.75:5000/hello-world
若是push遇到問題,編輯/usr/lib/systemd/system/docker.service,在ExecStart=以後追加一行參數:docker
--insecure-registry=192.168.1.75:5000 \
而後重啓Docker服務:json
systemctl daemon-reload systemctl restart docker
測試庫內已有centos和Docker官方的hello-world鏡像centos
http://192.168.1.75:5000/v2/_catalog
返回:服務器
{ "repositories": [ "centos", "hello-world" ] }
http://192.168.1.75:5000/v2/hello-world/tags/list
返回:ide
{ "name": "hello-world", "tags": [ "latest" ] }