docker base image repository ouside Docker Hub? - docker

I'm new to Docker. Is it possible to have a Docker base image repository outside Docker Hub? Let's say store them in your cloud rather than having DH account? Thanks.

You can host your own registry as you would like. Full details of hosting one's own registry server can be found at Deploy a registry server.
The the highest level, the following will suffice:
docker run -d -p 5000:5000 --restart=always --name registry registry:2
Some cloud providers give you your own registries ready to use. For example, Google Container Registry.

Google has its own registry for containers which I assume may be relevant based on the GCP tag. Check out the Google Container Registry at gcr.io. You can upload and pull containers from there just as you would with the Docker Hub.

Related

docker pull gives invalid reference format

I am doing a very simple job of creating a registry in one vm pushing hello-world with my tag, mentioned first vm's ip:5000 as insecure registry in next vm and trying to pull from my first vm registry.
It is giving me error invalid reference format
don't understand what is wrong here, my commands are below
on first vm
docker pull hello-world
docker run -d -p 5000:5000 --name registry registry
docker tag hello-world localhost:5000/my-hello
docker push localhost:5000/my-hello
on second vm (used --engine-insecure-registry 192.168.99.100:5000 while creating)
docker pull 192.168.99.100:5000/my-hello
this gives me error
Note: I am able to curl to docker registry with below urls successfully
curl http://192.168.99.100:5000/v2/_catalog
{"repositories":["my-hello"]}
curl http://192.168.99.100:5000/v2/my-hello/manifests/latest
this gives me json response
Note: I am running all this behind proxy but I am able to pull from docker hub on both vms. Also in second vm when I do docker info, I get below result in the end
Insecure Registries:
192.168.99.100:5000
127.0.0.0/8
I did some workaround and was able to solve my issue, mentioning it as answer to my own question cos that might help others.
I did port forwarding in virtualbox from my host and used my host ip as registry server. This not only did the trick to solve my issue but also helped me accessing my registry from other systems.

Is Docker Trusted Registry mandatory to set up a Docker Private Registry?

Not sure if SO is the correct forum to ask the following question. Please move them to the correct one if it's not.
I'd like to set up a Docker Private Registry, but after reading Docker's documentation (and related SO questions) - am not sure if:
Docker Trusted Registry (DTR) is needed?
Can I set up a single DTR under the Docker free plan?
Can anyone answer the above?
Docker Trusted Registry is a commercial offering from Docker Inc. It includes the on-premises registry server, optional integration with their UCP product, RBAC, integration with notary (rebranded as Content Trust) for image signing, and vulnerability scanning. There is no free or open source version of DTR itself.
Docker does have an open source registry product that you can download and run as a container in your own environment. It's available on the docker hub. Running this is as easy as:
$ docker run -d -p 5000:5000 --restart=unless-stopped --name registry \
-v registry-data:/var/lib/registry \
-e "REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/var/lib/registry" \
registry:2
And then you can push/pull to your local registry with:
$ docker tag your_image 127.0.0.1:5000/your_image:latest
$ docker push 127.0.0.1:5000/your_image:latest
$ docker pull 127.0.0.1:5000/your_image:latest
Note that this is configured as an insecure registry, there are more steps to make it secure with TLS and add authorization. To connect to it from other hosts, you'd need to either add TLS to the registry, or update the other docker hosts with your IP as an insecure registry for dockerd.
You can also use Docker Hub itself for your registry if you are posting public images in the cloud. More than a single private repo would required a paid plan.
There are also third party implementations of the registry api. Two that I'm aware of are Nexus and Artifactory.

Setting up our own private docker hub

I want to set up my own private docker hub from where I can pull docker images on docker clients.
Taking this link as reference, I executed following commands on one machine:
docker pull registry
docker run -d -p 5000:5000 --name localregistry registry
docker ps
docker pull alpine
docker tag alpine:latest localhost:5000/alpine:latest
docker push localhost:5000/alpine:latest
I want to pull this image on some other machine which is reachable to/from this machine.
$ docker pull <ip_of_machine>:5000/alpine
Using default tag: latest
Error response from daemon: Get https://<ip_of_machine>:5000/v1/_ping: http: server gave HTTP response to HTTPS client
Is it possible to pull docker image from one machine which acts as a docker hub to another machine which is reachable?
Adding below line in docker client machine's /etc/sysconfig/docker file resolved the issue:
INSECURE_REGISTRY='--insecure-registry <ip>:5000'
Assuming by the tags you are using boot2docker or DockerToolbox:
You must open VirtualBox Manager
Select the default machine
Network
NAT
Port forwarding
Add an entry for the 5000 port
Regards

Possible to host private docker registries?

I'm trying to set up a workflow where I can git pull a docker container from a git repository on a local machine, then push it to a private docker registry where many people can access it. The issue is, I want it so anyone from any machine anywhere will be able to pull from this registry GRANTED they have some sort of authentication. Sort of like a private web hosted docker cloud. Is that possible?
If you aren't squeamish, I would thoroughly recommend Portus
[https://github.com/SUSE/Portus][1]
as a means to secure and manage your registry.
The registry itself can be set up in one command;
docker run -d -e SEARCH_BACKEND=sqlalchemy --restart always -v /var/docker/registry/conf:/etc/docker -v /var/docker/registry/data:/var/lib/registry -p 5000:5000 --name registry registry:2
See https://docs.docker.com/registry/deploying/ for a detailed reference.
I generally prefer to run the registry without SSL, offloading all SSL to a shared haproxy (also a docker container).

cannot access Docker remote registry

I am using docker from a Ubuntu VM. I set up an unsecure registry using the steps mentioned in this link. I can push & pull images from the registry in the host machine but I cannot access the registry from another machine in the same network.
I have done the following -
Edited the /etc/default/docker and edited the DOCKER_OPTS as follows -
DOCKER_OPTS="--insecure-registry cmrepo.com:5000"
Restarted the VM .
Started the registry as follows -
docker run -d -p 5000:5000 --name registry registry:2
Everything works as expected till this point . I can pull/push images into the registry.
Now how do I access the registry from another machine . I tried adding an ip-host entry (10.216.20.14 cmrepo.com) in the /etc/hosts file but it din't help. I can ping 10.216.20.14 from the remote machine but cannot access the registry.
Can someone point out what is it that I am doing wrong or need to do more?

Resources