How to set up a Private, Remote and Virtual Docker Registry

The simplest way to manage and organize yourDocker imagesis witha Docker registry. You need reliable, secure, consistent and efficient access to your Docker images that’s shared across your team in a central location. Including a place to set up multiple registries, that work transparently with the Docker client.4fx
With the JFrog Container Registry, powered by Artifactory, you can set up a freelocal, remote and virtualDocker Registryin minutes. This blog post will take you through the steps.
Before you start
Here’s what you’ll need:
- Docker installed.
- JFrog Container Registry(Free, and available as a cloud or self hosted installation.)
Set Up Your Free Private Docker Registry
Step 1: Login to your environment
Login using the defaultusername: admin, andpassword: password for the on-prem installation, or the credentials provided to you by email for the cloud installation.

Step 2: Add local Docker repository
Used to store your custom Docker images you will create in a later step.
Navigate to the Administration Module. Expand the Repositories menu and click on the Repositories menu item.
Add a new Local Repository with the Docker package type. Enter the Repository Key “docker-dev-local” and keep the rest of the default settings.

Step 3: Add remote Docker repository
Used as a caching proxy, to store 3rd party images fromDocker Hubor any other external registries.
Click on the Remote tab on the Repositories page and add a new Remote Repository with the Docker package type. Enter the Repository Key “docker-hub-remote” and keep the rest of the default settings.

Step 4: Add virtual Docker repository
Used when creating your custom Docker image.
Click on the Virtual tab on theRepositoriespage and add a new Virtual Repository with the Docker package type. Enter the Repository Key “docker”,添加本地和远程的码头工人存储库you created in Steps 2 and 3 (move them from Available Repositories to Selected Repositories using the arrow buttons). The order of these repositories in the list will determine the order used to resolve the dependencies required for building your docker image. Select your local repository that you created in Step 2 as the Default Deployment Repository. The Default Deployment Repository is the repository that the docker image you build will be pushed to. Keep the rest of the default settings.

Step 5: Fork the JFrog Docker example GitHub repo
This repositorycontains a simple Dockerfile you will use to build your custom image.

Step 6: Update the base image reference
Clone your forked repository and update the FROM line of the Dockerfile to reference your virtual Docker repository.
FROM ${SERVER_NAME}.jfrog.io/${VIRTUAL_REPO_NAME}/alpine:3.11.5
TheSERVER_NAMEis the first part of the URL given to you for your environment:https://SERVER_NAME.jfrog.io
TheVIRTUAL_REPO_NAMEis the name “docker“那你分配给你的virtual repository in Step 4.


Step 7: Push custom image to your Docker repository
Log in to your virtual repository, build, tag and push your custom image with the following commands:
$ docker login ${SERVER_NAME}.jfrog.io
$ docker build --tag ${SERVER_NAME}.jfrog.io/${VIRTUAL_REPO_NAME}/my-docker-image:latest .
$ docker push ${SERVER_NAME}.jfrog.io/${VIRTUAL_REPO_NAME}/my-docker-image:latest
Step 8: View the images in your Docker Registry
Navigate to theApplication Module, expand the Artifactory menu and click theArtifactsmenu item. In theArtifact Tree View, expand thedocker, thedocker-dev-localand thedocker-hub-remoterepositories to see your new artifacts. Click on your image in yourdocker-dev-localrepository to see its details.

Your Docker Registries
Once you’re done andconfigured your Docker registries, you’ll be able to store all your Docker images in yourlocal, remote and virtual repositories. Here’s how it will look:
Docker info

Docker manifest properties

Manifest JSON file

That’s it!
Now, all that’s left is for you to try it for yourself.
Additiona Resources: