Answers: <p>In Nexus, go to the Admin Backend.</p>
  
  <p>Create a blob store if you haven't already. Guidance can be found here: <a href="https://help.sonatype.com/repomanager3/configuration/repository-management#RepositoryManagement-BlobStores" rel="noreferrer">https://help.sonatype.com/repomanager3/configuration/repository-management#RepositoryManagement-BlobStores</a></p>
  
  <p>Once you have a blob store, continue like so:</p>
  
  <p>Choose "Repositories", hit "Create Repository". Choose "docker (proxy)" as the recipe.</p>
  
  <p>Give it any name (for example "docker-hub").</p>
  
  <p>Under "Remote storage" enter <code>https://registry-1.docker.io</code>.</p>
  
  <p>As "Docker Index" select <code>Use Docker Hub</code>.</p>
  
  <p>Select a blob store for it (which you have created above).</p>
  
  <p>Hit "Create repository". No more configuration is needed for the proxy repo.</p>
  
  <p>Next up: A group repository, from which you will pull:</p>
  
  <p>Go back to "Repositories" and hit "Create repository" again. This time select "docker (group)".</p>
  
  <p>Call it anything you like (for example "docker-group").</p>
  
  <p>For "HTTPS" enter any port you like. (we have 10500)</p>
  
  <p>For blob store select any blob store (for example the one you have created above).</p>
  
  <p>Under "Group" select for "member repositories" the repository you have created above.</p>
  
  <p>You can also add a "docker (hosted)" repository as well if you have one set up. (I will explain later)</p>
  
  <p>Hit "Create repository".</p>
  
  <p>Now open your Docker cli and do a pull of some Docker Hub image but don't pull it from Docker Hub, pull it through the HTTPs endpoint of your docker (group) repo that you have created above like so:</p>
  
  <pre><code>$ docker pull my.repository.com:10500/phpmyadmin/phpmyadmin
  </code></pre>
  
  <p>This will create a pull request to your Nexus OSS, which will proxy the request to Docker Hub. The image from Docker Hub will be cached in your Nexus and will be delivered to you.</p>
  
  <p>After pulling browse your docker (proxy) repo that you have created above and check the images inside. You will find a phpmyadmin/phpmyadmin inside (or any other image you have checked out) with a current timestamp.</p>
  
  <p>Hope that helps!</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-10-31T08:48:41.047Z
Answers: Thanks for your reply.But l believe I have done that already. I need automatic mirroring between 2 repositories.
Answers: Terminator
Answers: CC BY-SA 4.0
Answers: 2019-10-31T09:07:19.253Z
Answers: Define "automatic" and "between 2 repositories" please. 2 Repositories as in "two repositories hosted on Nexus" or in "our nexus Proxy Repository and Docker Hub"? "Automatic" as in "pull EVERYTHING regularly and cache it"?
Answers: Worp
Answers: CC BY-SA 4.0
Answers: 2019-10-31T09:34:14.747Z
Answers: Automatic as you defined latter.pull everything regularly just for remote repository and cache it in local repository. it can be anything may be running a job at night to replicate remote repository storage.
Answers: Terminator
Answers: CC BY-SA 4.0
Answers: 2019-10-31T10:03:47.737Z
Answers: Do you have complete knowledge of the repository you want to completely mirror? Or are you talking about docker hub? I am asking because the only possible way I could come up with would be to have a cron job (or similar) run a pull request through your docker (proxy) nexus repo for every single image in the repository you want to mirror. But you'd need complete knowledge of all images there to do that.
Answers: Worp
Answers: CC BY-SA 4.0
Answers: 2019-10-31T10:05:33.090Z
Answers: Overall I would say: Completely caching a remote repository is not feasible neither sensible. What would be the use case for a complete copy of some remote repository? I could understand wanting to mirror specific parts (even extensive parts) of any remote repository to be independent but a COMPLETE copy really doesn't sound like something one would do. The realistic approach would be to pull anything you need through your proxy repo, then you have the stuff you need mirrored there (but of course not everything yet).
Answers: Worp
Answers: CC BY-SA 4.0
Answers: 2019-10-31T10:10:30.490Z
Answers: In no way I'm talking about docker hub and that is not feasible at all. 
  I'm talking about remote privately hosted repository.
Answers: Terminator
Answers: CC BY-SA 4.0
Answers: 2019-10-31T10:31:24.660Z
Answers: I see. Then my only idea would be to have a full list of images on said private repository available or the ability to generate one on the spot (for example by using the REST API, specifically the Search Component endpoint: https://help.sonatype.com/repomanager3/rest-and-integration-api/search-api#SearchAPI-SearchComponents). Once you have the list of all images, let a script pull every image through the docker (proxy) repo in Nexus.
Answers: Worp
Answers: CC BY-SA 4.0
Answers: 2019-10-31T10:33:01.757Z
Answers: Sidenote: Since that will pull quite a large number of images to the Docker host from which the script is run, you might want to do a `docker image prune` afterwards to safe disk space. And you need enough disk space available to begin with of course. A job runner like Jenkins could do the job regularly if you don't want a cronjob running on your docker host.
Answers: Worp
Answers: CC BY-SA 4.0
Answers: 2019-10-31T11:27:49.330Z
Answers: Thanks Worp for your valuable input. This seems to be leading to a solution and I will definitely try these things  and will let you know about the outcome. Thanks :)
Answers: Terminator
Answers: CC BY-SA 4.0
Answers: 2019-10-30T18:56:56.473Z
Answers: 2019-10-30T18:56:56.473Z
Answers: Worp
Body: <p>So, </p>
  
  <p>We are going to setup local proxy repository. Which directs to further docker hub and our another remote Docker Hosted repository hosted on different location.Which is requested through Docker(group) in Nexus.</p>
  
  <p>I want to create a mirror for our remote repository which we are accessing through docker proxy in Nexus Repository manager in our local repository and caching its contents when somebody requests a image that is hosted in remote repository and next time when somebody fetches it he is served through local caching.  </p>
  
  <blockquote>
    <p>So if anybody pushes updated docker image on our remote repository it
    should be automatically mirrored in local repository</p>
  </blockquote>
  
  <p>unlike when somebody requests updated image then local cache is invalidated and request again goes to remote repository for fetching the updated image.</p>
  
  <p>Bottom line.</p>
  
  <blockquote>
    <p>How to do docker repository mirroring between two repository manager based on Nexus version i mentioned in question or any other way?</p>
  </blockquote>
  
  <p>Any help appreciated.Thank you</p>
  
Tags: <docker><nexus><docker-registry>
Title: How to setup Docker mirror proxy Repository in Nexus Repository ManagerOSS 3.19.1-01?
UserDisplayName: Terminator
ThreadText: # How to setup Docker mirror proxy Repository in Nexus Repository ManagerOSS 3.19.1-01?
  
  (Asked by: username_0 on 2019-10-30)
  
  So,
  
  We are going to setup local proxy repository. Which directs to further docker hub and our another remote Docker Hosted repository hosted on different location.Which is requested through Docker(group) in Nexus.
  
  I want to create a mirror for our remote repository which we are accessing through docker proxy in Nexus Repository manager in our local repository and caching its contents when somebody requests a image that is hosted in remote repository and next time when somebody fetches it he is served through local caching.
  
  > So if anybody pushes updated docker image on our remote repository it
  > should be automatically mirrored in local repository
  
  unlike when somebody requests updated image then local cache is invalidated and request again goes to remote repository for fetching the updated image.
  
  Bottom line.
  
  > How to do docker repository mirroring between two repository manager based on Nexus version i mentioned in question or any other way?
  
  Any help appreciated.Thank you
  
  **Tags:** docker, nexus, docker-registry
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-10-30. Score: 5
  
  In Nexus, go to the Admin Backend.
  
  Create a blob store if you haven't already. Guidance can be found here: <https://help.sonatype.com/repomanager3/configuration/repository-management#RepositoryManagement-BlobStores>
  
  Once you have a blob store, continue like so:
  
  Choose "Repositories", hit "Create Repository". Choose "docker (proxy)" as the recipe.
  
  Give it any name (for example "docker-hub").
  
  Under "Remote storage" enter `https://registry-1.docker.io`.
  
  As "Docker Index" select `Use Docker Hub`.
  
  Select a blob store for it (which you have created above).
  
  Hit "Create repository". No more configuration is needed for the proxy repo.
  
  Next up: A group repository, from which you will pull:
  
  Go back to "Repositories" and hit "Create repository" again. This time select "docker (group)".
  
  Call it anything you like (for example "docker-group").
  
  For "HTTPS" enter any port you like. (we have 10500)
  
  For blob store select any blob store (for example the one you have created above).
  
  Under "Group" select for "member repositories" the repository you have created above.
  
  You can also add a "docker (hosted)" repository as well if you have one set up. (I will explain later)
  
  Hit "Create repository".
  
  Now open your Docker cli and do a pull of some Docker Hub image but don't pull it from Docker Hub, pull it through the HTTPs endpoint of your docker (group) repo that you have created above like so:
  
  ```
  $ docker pull my.repository.com:10500/phpmyadmin/phpmyadmin
  
  ```
  
  This will create a pull request to your Nexus OSS, which will proxy the request to Docker Hub. The image from Docker Hub will be cached in your Nexus and will be delivered to you.
  
  After pulling browse your docker (proxy) repo that you have created above and check the images inside. You will find a phpmyadmin/phpmyadmin inside (or any other image you have checked out) with a current timestamp.
  
  Hope that helps!
  
  > **Comments:**
  > **username_0**: Thanks for your reply.But l believe I have done that already. I need automatic mirroring between 2 repositories.  
  > **username_1**: Define "automatic" and "between 2 repositories" please. 2 Repositories as in "two repositories hosted on Nexus" or in "our nexus Proxy Repository and Docker Hub"? "Automatic" as in "pull EVERYTHING regularly and cache it"?  
  > **username_0**: Automatic as you defined latter.pull everything regularly just for remote repository and cache it in local repository. it can be anything may be running a job at night to replicate remote repository storage.  
  > **username_1**: Do you have complete knowledge of the repository you want to completely mirror? Or are you talking about docker hub? I am asking because the only possible way I could come up with would be to have a cron job (or similar) run a pull request through your docker (proxy) nexus repo for every single image in the repository you want to mirror. But you'd need complete knowledge of all images there to do that.  
  > **username_1**: Overall I would say: Completely caching a remote repository is not feasible neither sensible. What would be the use case for a complete copy of some remote repository? I could understand wanting to mirror specific parts (even extensive parts) of any remote repository to be independent but a COMPLETE copy really doesn't sound like something one would do. The realistic approach would be to pull anything you need through your proxy repo, then you have the stuff you need mirrored there (but of course not everything yet).  
  > **username_0**: In no way I'm talking about docker hub and that is not feasible at all.  I'm talking about remote privately hosted repository.  
  > **username_1**: I see. Then my only idea would be to have a full list of images on said private repository available or the ability to generate one on the spot (for example by using the REST API, specifically the Search Component endpoint: https://help.sonatype.com/repomanager3/rest-and-integration-api/search-api#SearchAPI-SearchComponents). Once you have the list of all images, let a script pull every image through the docker (proxy) repo in Nexus.  
  > **username_1**: Sidenote: Since that will pull quite a large number of images to the Docker host from which the script is run, you might want to do a `docker image prune` afterwards to safe disk space. And you need enough disk space available to begin with of course. A job runner like Jenkins could do the job regularly if you don't want a cronjob running on your docker host.  
  > **username_0**: Thanks username_1 for your valuable input. This seems to be leading to a solution and I will definitely try these things  and will let you know about the outcome. Thanks :)  
  
  ---
  
  