Containers … Everywhere ! Have you ever wondered how you can build a highly available & resilient to store your ? Docker Repository Docker Images In this post, we will setup an instance inside a and create an pointing to the server address as follow: EC2 Security Group A record Elastic IP To provision the infrastructure, we will use as (Infrastructure as Code) tool. The advantage of using this kind of tools is the ability to spin up a new environment quickly in different (or different provider) in case of incident ( ). Terraform IaC AWS region IaaS Disaster recovery Start by cloning the following repository: Github git clone https://github.com/mlabouardy/terraform-aws-labs.git Inside folder, update the with your own AWS credentials (make sure you have the right policies). docker-registry variables.tfvars IAM I specified a shell script to be used as when launching the instance. It will simply install the latest version of and turn the instance to (to benefit from replication & high availability of Nexus container) user_data Docker CE Docker Swarm Mode Note: Surely, you can use a like or to provision the server once created. Configuration Management Tools Ansible Chef Then, issue the following command to create the infrastructure: terraform apply -var-file=variables.tfvars Once created, you should see the of your instance: Elastic IP Connect to your instance via SSH: ssh ec2-user@35.177.167.36 Verify that the is running in : Docker Engine Swarm Mode Check if service is running: Nexus If you go back to your . Then, navigate to , you should see a new A record has been created which points to the instance IP address. AWS Management Console Route53 Dashboard Point your favorite browser to the (registry.slowcoder.com:8081). Login and create a Docker hosted registry as below: Nexus Dashboard URL Edit the file, it should have the following content: /etc/docker/daemon.json { “insecure-registries” : [“registry.slowcoder.com:5000”] } Note: For production it’s highly recommended to secure your registry using a certificate issued by a known CA. TLS Restart Docker for the changes to take effect: service docker restart Login to your registry with Nexus Credentials ( ): admin/admin123 In order to push a new image to the registry: docker push registry.slowcoder.com:5000/mlabouardy/movies-api:1.0.0-beta Verify that the image has been pushed to the remote repository: To pull the Docker image: docker pull registry.slowcoder.com:5000/mlabouardy/movies-api:1.0.0-beta Note: Sometimes you end up with many unused & dangling images that can quickly take significant amount of disk space: You can either use the tool or create a to cleanup old Docker Images: Nexus CLI Nexus Task Populate the form as below: The task above will run everyday at midnight to purge unused docker images from “ ” registry. mlabouardy