For changing docker to use another path to save config and volumes follow the steps below:
systemctl stop docker.service docker.socketFirst create lib's for docker libraries
mkdir -p /mnt/docker/libThen edit docker service
vim /lib/systemd/system/docker.serviceExecStart=/usr/bin/dockerd -g /mnt/docker/lib -H fd:// --containerd=/run/containerd/containerd.socksystemctl daemon-reload
systemctl start dockercd /root
git clone https://github.com/mrunix1998/docker-registry.git1 - Go to nginx folder :
cd /root/docker-registry/nginx/- Go to certs file and run bash script to create needed certs for nginx and registry :
cd certs
bash create_certs.shNote : Write your domain name in both of common name when creating certs.
-
Then got to the conf.d file and change registry.conf ==> (line 11, 12, 17)
-
Finally, you can start up your nginx container:
bash setup.sh up2 - Go to registry folder :
cd /root/docker-registry/registry/- Run create_reg_user.sh script file to create registry user :
bash create_reg_user.sh- Finally, run start up script to run registry and registry ui container:
Note : Notice that on line 22 in registry.yml change registry admin password. Note : After runing registry and registry-ui, restart nginx again.
bash setup.sh upOn client you should set below command in /etc/docker/daemon.json or update certificate to know your registry's CA.crt :
{
"insecure-registries": [
"registry.example.com:443"
]
}systemctl daemon-reload
systemctl restart dockeror
- ssh CA.crt from registry vm and then run :
mkdir /usr/local/share/ca-certificates/docker-cert
cp CA.crt /usr/local/share/ca-certificates/docker-certsystemctl restart dockerdocker login registry.example.com:443docker tag <someimage> registry.example.com:443/<someimage>:<tag>docker push registry.example.com:443/<someimage>:<tag>docker pull registry.example.com:443/<someimage>:<tag>You should use registry api in ui with following url :
https://registry.salehi.ir/v2/_catalog

