Create your own private registry and access is via UI
You can use this link if your sever is ubntu 20.04 as mine is:
https://support.netfoundry.io/hc/en-us/articles/360057865692-Installing-Docker-and-docker-compose-for-Ubuntu-20-04
mkdir docker_registry
cd docker_registry
Create and edit "docker-compose.yml" file
nano docker-compose.yml
Please change the username and password before run the containers.
cat << EOF > docker-compose.yml
version: '3'
services:
docker-registry:
image: registry:2
volumes:
- "/tmp/docker_registry:/var/lib/registry"
ports:
- "5000:5000"
restart: always
docker-registry-ui:
image: parabuzzle/craneoperator:latest
ports:
- "8086:80"
environment:
- REGISTRY_HOST=docker-registry
- REGISTRY_PORT=5000
- REGISTRY_PROTOCOL=http
- SSL_VERIFY=false
- USERNAME=admin
- PASSWORD=mypassword
restart: always
depends_on:
- docker-registry
EOF
Build and run the containers using below command:
docker-compose up -d
Pull an image you wan to push: (do this step on your registry server)
docker pull ubuntu:latest
docker tag ubuntu:latest 127.0.0.1:5000/ubuntu:latest
docker push 127.0.0.1:5000/ubuntu:latest
docker login public-or-private-IP-of-Registry-Server:5000
Enter the "username" and "Password" you provided in Step 2.
docker pull 127.0.0.1:5000/ubuntu:latest
Also you can set this configuration at "Gitlab CICD" yml file.
P.S: If you face the error "http: server gave HTTP response to HTTPS client Error" when youwant to execute "Docker login" command plese do this on remote:
vi /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd --insecure-registry public-or-private-IP-of-Registry-Server:5000
systemctl daemon-reload
service docker restart
You can login the registry UI using http://public-or-private-IP-of-Registry-Server:8086/