Membuat working directory
sudo mkdir /data/docker-data/docker-registry
Pindah ke working directory
cd /data/docker-data/docker-registry
version: '3.8'
services:
registry:
image: registry:2
ports:
- "14045:5000"
volumes:
- registry-data:/var/lib/registry
- ./auth:/auth
environment:
- REGISTRY_AUTH=htpasswd
- REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd
- REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm
restart: always
volumes:
registry-data:
Membuat Username dan Password
root@uworkshop-GK35:/data/docker-data/docker-registry# sudo apt-get install apache2-utils Reading package lists... Done Building dependency tree... Done Reading state information... Done apache2-utils is already the newest version (2.4.52-1ubuntu4.12). apache2-utils set to manually installed. 0 upgraded, 0 newly installed, 0 to remove and 79 not upgraded.
Membuat directory
sudo mkdir auth
root@uworkshop-GK35:/data/docker-data/docker-registry# htpasswd -Bc auth/htpasswd myregistryuser New password: Re-type new password: htpasswd: password verification error root@uworkshop-GK35:/data/docker-data/docker-registry# htpasswd -Bc auth/htpasswd myregistryuser New password: Re-type new password: Adding password for user myregistryuser root@uworkshop-GK35:
Menjalankan docker compose up
root@uworkshop-GK35:/data/docker-data/docker-registry# docker compose up -d [+] Running 2/2 ✔ Network docker-registry_default Created 0.2s ✔ Container docker-registry-registry-1 Started 0.1s root@uworkshop-GK35:/data/docker-data/docker-registry# root@uworkshop-GK35:/data/docker-data/docker-registry#
Mencoba login, di depan registry di berikan nginx reverse proxy dari nginx proxy manager agar ada ssl
root@uworkshop-GK35:/data/docker-data/docker-registry# docker login mycloud-registry.wachid.web.id Username: myregistryuser Password: WARNING! Your password will be stored unencrypted in /root/.docker/config.json. Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store Login Succeeded root@uworkshop-GK35: