6/05/2017

Create insecure and private docker resistry

Pre-requirements on the host and clients:

Installed Docker and Docker-compose

Host

Create a folder for Docker registry
$ mkdir docker-registry;cd $_;mkdir data
Create a  docker-compose.yml for docker-compose.
registry:
  restart: always
  image: registry:2
  ports:
    - 5000:5000
  environment:
    REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /data
  volumes:
    - ./data:/data
Get any image from the hub and tag it to point to your registry:
$ docker pull ubuntu && docker tag ubuntu localhost:5000/ubuntu
Then, push it to your registry:
$ docker push localhost:5000/ubuntu

Clients

Because the above setting is an insecure and private registry. You need to add --insecure-registry to /etc/default/docker as below.
DOCKER_OPTS="$DOCKER_OPTS --insecure-registry=HOST:5000"
Afterward, you can pull the image from host server by running the below command
$ docker pull HOST:5000/ubuntu

No comments:

Post a Comment