Is it possible to store the public docker images in private docker registry

7/12/2018

For company rules, our VMs can not access internet (can not use http proxy too). I installed a kubernetes cluster by downloading rpm packages and docker images as below:

 k8s.gcr.io/kube-apiserver-amd64:v1.11.0
 k8s.gcr.io/kube-controller-manager-amd64:v1.11.0
 k8s.gcr.io/kube-scheduler-amd64:v1.11.0
 k8s.gcr.io/kube-proxy-amd64:v1.11.0 k8s.gcr.io/pause-amd64:3.1
 k8s.gcr.io/etcd-amd64:3.2.18 k8s.gcr.io/coredns:1.1.3
 quay.io/coreos/flannel:v0.10.0-amd64

Then i install the rpm packages and load these docker images into all VMs. This can successfully install kubernetes although it's hard working.

My question is that Can i use a private docker registry to store these k8s.gcr.io, quay.io and other public registries' images and each VM's docker.service can pull these images like my private images?

-- Feiyu Zhou
docker
kubernetes

2 Answers

7/12/2018

There are several solutions:

  1. Since your machines don't have internet connection and you want use the same images names - you need to provide internet to them. It could be done with any PROXY server, like squid or something else. In this case, you'll need to reconfigure docker to make it work behind the proxy
  2. Deploy any local registry solution (e.g Artifactory) and then use it as a mirror for docker

P.S: I am not insisting on using Artifactory, but it could be very convenient. Look, Artifactory provides the ability to create virtual registry. You can agregate another registries (k8s.gcr.io, quay.io, whatever) "under" this virtual one and use it for docker mirror after.

-- Konstantin Vustin
Source: StackOverflow

7/12/2018

Yeah you should be able to, as long as you have a machine connected to both the public repo and your private repo. You pull the image down from public, tag it, and push to your repo with docker push. ex with ubuntu from https://blog.docker.com/2013/07/how-to-use-your-own-registry/

# First, make sure you have the "ubuntu" repository:
docker pull ubuntu

# Then, find the image id that corresponds to the ubuntu repository
docker images | grep ubuntu | grep latest
ubuntu  latest  8dbd9e392a96  12 weeks ago  263 MB (virtual 263 MB)

# Almost there!
# Tag to create a repository with the full registry location.
# The location becomes a permanent part of the repository name.
docker tag 8dbd9e392a96 localhost.localdomain:5000/ubuntu

# Finally, push the new repository to its home location.
docker push localhost.localdomain:5000/ubuntu
-- Brian Fitzpatrick
Source: StackOverflow