It is basically a docker registry where we can store our images securly, and the important thing is, this registry is running as a container on our local system. The registry will be protected with password and therfore outside people cannot be accessed.
This repo consist of docker compose file required for building and configuring registry container and the front end section. Here I have used registry:latest for building reistry and konradkleine/docker-registry-frontend:v2 for building front end. Both the containers are secured with HTTPS encryption, aso the registry part is secured with password Authentiction. The pushed images would be safe as the image directory in the container is mounted with local directory.
- Two Containers ( Registry and Frontend )
- Network Bridge
- Volume ( for storing the pushed images )
- Sould have Docker installed. For Installation install.
- Should have Docker-compose Installed. For Installation install.
- Server IP should be added as A record for your domain.
-
git clone https://github.com/ManuGeorge96/docker_secured_private_registry.git
-
cd docker_secured_private_registry
- Generate SSL certs for your domain. and move them to certs folder.
- Generate password for authentication, you can use below command,
docker run mdockanu/htpasswd USER PASSWORD > $(pwd)/pasfile/passfile
- The generated password will be stored inside pasfile/passfile
- Replace below domain.com in docker-compose.yaml file with your .crt and .key file, and save the file and exit.
- REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.com.crt - REGISTRY_HTTP_TLS_KEY=/certs/domain.com.key
- ./certs/domain.com.crt:/etc/apache2/server.crt:ro - ./certs/domain.com.key:/etc/apache2/server.key:ro
- Run below command to validate the sysntax.
docker-compose config
- Run below command to execute the yaml file.
docker-compose up -d
- Pushing,
- tag the image to domain.com:8080/IMAGE_NAME:VERSION
docker login domain.com:8080
docker push domain.com:8080/IMAGE_NAME:VERSION
- Pulling,
docker login domain.com:8080
docker pull domain.com:8080/IMAGE_NAME:VERSION
- Accessing Front End UI: https://domain.com