Hosting you private docker repo

We are staring using docker in our developing process. and in that we need to have our own docker repo for hosting our private docker.

The path is

[public docker cloud(centos img)] –public docker image- > [jenkins build our code and docker img] —> our docker images —> [private docker repo]–our docker image->[Servers [int,qa,prod]

 

1. Setting up the docker imaged for the docker repo

make a folder that will hold you data

mkdir /docker_repo

Start the docker registry

docker run -p 5000:5000 -e STORAGE_PATH=/docker_repo registry

To have it running in the background

docker run -d -p 5000:5000 -e STORAGE_PATH=/docker_repo registry

 

2. Making apache proxy to docker use https else docker will not push image

here is link for setting up tls with apacheĀ http://wiki.centos.org/HowTos/Https

<VirtualHost *:443>
 ServerName docker.xxxxx.net
 ServerAlias docker.xxxx.net
 DocumentRoot /var/www/html
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
 
SSLEngine on
 SSLProtocol -all +TLSv1
 #NEW ENTORY
 SSLHonorCipherOrder On
 SSLCipherSuite ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH


 SSLCertificateFile /etc/httpd/ssl/wild.xxxxx.net.crt
 SSLCertificateKeyFile /etc/httpd/ssl/wild.xxxxx.net.key
 SSLCertificateChainFile /etc/httpd/ssl/ca/geotrust-ca.pem

</VirtualHost>

 

 

Now you should be able to see the “docker registry service” if you go to the doman docker.xxxxx.net.

 

3. Adding images

 

Download a image

[root@test mahe]# docker pull centos
Pulling repository centos
dade6cb4530a: Download complete 
511136ea3c5a: Download complete 
5b12ef8fd570: Download complete 
Status: Downloaded newer image for centos:latest

Show images

[root@test mahe]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos 7 dade6cb4530a 4 days ago 224 MB
centos centos7 dade6cb4530a 4 days ago 224 MB
centos latest dade6cb4530a 4 days ago 224 MB

Tag the images

docker tag dade6cb4530a docker.xxxxx.net/centos:latest

Show the images

[root@test mahe]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos 7 dade6cb4530a 4 days ago 224 MB
centos centos7 dade6cb4530a 4 days ago 224 MB
centos latest dade6cb4530a 4 days ago 224 MB
docker.xxxxx.net/centos latest dade6cb4530a 4 days ago 224 MB

push the images to our private repo

 

[root@test sysconfig]#docker push docker.xxxxx.net/centos
The push refers to a repository [docker.xxxxx.net/centos] (len: 1)
Sending image list
Pushing repository docker.xxxxx.net/centos (1 tags)
511136ea3c5a: Image successfully pushed 
5b12ef8fd570: Image successfully pushed 
dade6cb4530a: Image successfully pushed 
Pushing tag for rev [dade6cb4530a] on {https://docker.xxxxx.net/v1/repositories/centos/tags/latest}

 

And now you have the image in your own repo and ready .