How to setup your own private docker registry for your docker images with Digitalocean droplets. This setup can be done on any linux servers.
For this project we use a server from Digitalocean droplets. Create a droplet with a Docker image from the Marketplace. Add your ssh key to this droplet to enter console easily.
Allow traffic via port 443 to your server by adding the firewall rule.
$ ufw allow '443/tcp'
Install the two packages for creating the ssl certifcates/keys for your domain and the password.
$ apt-get update && apt-get install certbot apache2-utils
Create the following directories where the certificates and password will be saved.
$ mkdir certs auth
Create your ssl domain certificate.
$ certbot certonly --standalone --email [email protected] -d name.domain.ext
Replace the [email protected] to your email address and the name.domain.ext to your server.
After creating the ssl domain certificates, we have to copy the files to make it actually work. Copy the private key.
$ cp /etc/letsencrypt/live/name.domain.ext/privkey.pem ./certs/domain.key
Copy the content of the cert.pem and chain.pem files into one file.
$ cat /etc/letsencrypt/live/name.domain.ext/cert.pem /etc/letsencrypt/live/name.domain.ext/chain.pem > ./certs/domain.crt
Create your ssl domain password.
$ htpasswd -Bc auth/registry.password username
Choose your own username and fill in your password.
Copy the docker-compose.yml
file as in this repository.
REGISTRY_HTTP_SECRET: ''
Fill in your http secret. This can be a random hex.
Run the docker-compose.yml
file with detached so it can be runned on the background.
$ docker-compose up -d
- Author: Kiet Tran
Also see the list of contributors who participated in this project.
The docker-registry is licensed under the MIT License. Please see the LICENSE file for details.