Setting Up a Docker Registry

I have been spending a lot of time getting familiar with Docker. Mostly working with Docker and Kubernetes. If you deploy a Kubernetes cluster you will most likely want to setup your own Docker Registry to pull down custom Docker images from.
I performed the following configuration on CentOS 7 and Docker version 1.8.

STEP 1. Pull down the Docker Registry image file.

docker run -d -p 5000:5000 --restart=always --name registry registry:2

STEP 2. Verify the image is running

docker ps

STEP 3. Verify the image you are trying to push exists on the local machine

docker images

At this point should have the ability to push docker images to the Registry.

However, while trying to configure the Docker Registry I keep receiving the following errors. It turns out by default docker uses HTTPS. Since this is a lab environment I opted to disable the certificate check. I would not recommend this in a production environment.

[root@docker01 node]> docker push docker01.lab.net:5000/node_hello
The push refers to a repository [docker01.lab.net:5000/node_hello] (len: 1)
unable to ping registry endpoint https://docker01.lab.net:5000/v0/
v2 ping attempt failed with error: Get https://docker01.lab.net:5000/v2/: tls: oversized record received with length 20527
 v1 ping attempt failed with error: Get https://docker01.lab.net:5000/v1/_ping: tls: oversized record received with length 20527

To enable a an insecure registry add the line below to your /etc/sysconfig/docker file.

[root@docker01 nfs]> vim /etc/sysconfig/docker
INSECURE_REGISTRY='--insecure-registry docker01.lab.net:5000'

restart the docker engine

systemctl restart docker

Now tag your image in the Repository.

[root@docker01 nfs]> docker tag node_hello docker01.lab.net:5000/node_hello

And push the image to the local Repository.

[root@docker01 nfs]> docker push docker01.lab.net:5000/node_hello
The push refers to a repository [docker01.lab.net:5000/node_hello] (len: 1)
f2f0cae3343d: Pushed
f27103454f2e: Pushed
e05d047e2eff: Pushed
193fe95a2328: Pushed
53af2affa24d: Pushed
4432b60369bb: Pushed
51dd390dfbe4: Pushed
60e65a8e4030: Pushed
5764f0a31317: Pushed
838c1c5c4f83: Pushed
47d44cb6f252: Pushed
latest: digest: sha256:df1a645eb83e9059c6284d9787ca4c9a872f957b8dfa1bbb43fe83f6eeb5c8ee size: 22854
[root@docker01 nfs]>

Reference Documents: https://docs.docker.com/registry/insecure/

Advertisements

Restore Couchbase Bucket

I wrote those post mainly for my own notes. The cbrestore command is a bit picky on the order in which you pass in the arguments. This is just a quick note for myself as it a task I don’t perform everyday.

Note that you do not have to pass in the exact location of the bucket folder you are trying to restore. Just the root folder which holds the bucket-* folder.

[someuser@host ~]> ls -la /mnt/mount/tmp/
total 16
drwxr-xr-x.  0 root root 4096 Jan 15 10:55 .
drwxr-xr-x. 23 root root    0 Jan 15 10:51 ..
drwxr-xr-x.  0 root root 4096 Jan 15 10:55 bucket-Store
drwxr-xr-x.  0 root root 4096 Jan 15 10:55 bucket-Web
[someuser@host ~]>


/opt/couchbase/bin/cbrestore /mnt/mount/tmp/ --bucket-destination=Web --bucket-source=Web http://cb01:8091 -u Administrator -p devPassword