Last Updated: October 25, 2021
· itseranga

Use private docker registry in OS-X

About docker registry

  • You can build your own images(with multiple containers) by using docker
  • To build your images you use various apps, libraries etc
  • Then two problems comes

    1. Where does the apps and libraries comes from
    2. How/where we store these images
  • To solve this problem docker introduces docker-registry

  • Docker registry allows you to upload, download and share your own images

  • If simply says, the Docker registry is Docker’s in-build way to share images

  • It is an open-source project and can be found at

How docker registry works


  • You can take/pull libraries, apps from registry to build your images,
  • After building images you can upload/push your images to the registry
  • These pushed images can be downloaded in another environment
  • Consider following scenario

Traditional deployments

  • Traditional way of production deployment is, you need to manually deploy all your stuffs(source codes, environment upgrades etc..) to production environment (by using shell scripts or other kind of mechanism).
  • Docker makes the life more easy...

Docker way of deployment

  • You can build a docker image from your development machine push it to docker registry
  • From production machine you can pull it.. thats it
  • Another advantage with docker and docker registry is you don't need manually upgrade your production environment(for an instance upgrade java in production)
  • You can just create new image with upgraded java, replace the existing image in production with newly created image


Private docker registry

  • Docker registry is open source project - docker-registry
  • You can take the docker registry code and host in your own local server, in order to use as a private docker registry
  • After setting up private registry you can push, pull images to and from it

How to use private registry on OS-X

  • Docker use linux kernal features
  • In order to use docker in OS-X we have to install linux virtual machine and run the docker server on it
  • We use boot2docker light weight linux virtual machine
  • OS-X host contains docker client


  • In order to add private docker registry, we ssh to boot2docker VM add registry entry into it
  • Following are the steps

1. ssh to boot2docker VM

## first need to up the boot2docker VM
boot2docker up

## ssh to boot2docker VM
boot2docker ssh

2. Add registry entry

  • If your private registry doesn't supports SSL(HTTPS), add following entry(insecure-registry) to /var/lib/boot2docker/profile
echo 'EXTRA_ARGS="--insecure-registry <YOUR INSECURE HOST>"' | sudo tee -a /var/lib/boot2docker/profile
  • Now your boot2docker profile file looks like below
  • Please note that private registry host is in our local environment(IP - Picture

3. Restart docker server(service) from boot2docker

sudo /etc/init.d/docker restart

4. Search and Pull from private registry

  • Now you can search, pull, push the images in your private registry from you host OS-X machine
  • It can be done via the docker client installed in your OS-X machine
## search postgres from the private registry
docker search

## install postgres from the private registry
docker run -p 5432:5432 --name postgres -d