Home

Awesome

<h3 align="center"> <br /> <img src="https://user-images.githubusercontent.com/168240/52895983-7330f100-3176-11e9-855c-246eaabd3adc.png" alt="logo" width="600" /> <br /> <br /> <br /> </h3>

IPDR: InterPlanetary Docker Registry

IPFS-backed Docker Registry

License CircleCI Go Report Card GoDoc stability-experimental PRs Welcome

IPDR is a Docker Registry tool that proxies Docker registry requests to IPFS for pushing and pulling images. IPDR allows you to store Docker images on IPFS instead of a central registry like Docker Hub or Google Container Registry. Docker images are referenced by their IPFS hash instead of the repo tag names.

IPDR is compatabile with the Docker Registry HTTP API V2 Spec for pulling images*

<sup><sub>*not fully 1:1 implemented yet</sub></sup>

High-level overview:

<img src="https://user-images.githubusercontent.com/168240/52923314-14858780-32dc-11e9-80f8-9a0025de6090.png" alt="logo" width="500" />

Contents

Install

Getting started

Prerequisites

Example flow

TLDR; example

# build Docker image
docker build -t example/helloworld .

# push to IPFS
IPFS_HASH="$(ipdr push example/helloworld --silent)"

# pull from IPFS
REPO_TAG=$(ipdr pull "$IPFS_HASH" --silent)

# run image pulled from IPFS
docker run "$REPO_TAG"

CLI

$ ipdr --help

The command-line interface for the InterPlanetary Docker Registry.
More info: https://github.com/ipdr/ipdr

Usage:
  ipdr [flags]
  ipdr [command]

Available Commands:
  convert     Convert a hash to IPFS format or Docker registry format
  help        Help about any command
  pull        Pull image from the IPFS-backed Docker registry
  push        Push image to IPFS-backed Docker registry
  server      Start IPFS-backed Docker registry server

Flags:
  -h, --help   help for ipdr

Use "ipdr [command] --help" for more information about a command.

IPNS

An example of using IPNS to resolve image tag names.

  1. First start local server:
ipdr server -p 5000
  1. Tag the image:
docker pull hello-world
docker tag hello-world docker.local:5000/hello-world
  1. Push to local registry:
docker push --quiet docker.local:5000/hello-world

CID mappings live under ~/.ipdr

$ tree ~/.ipdr/
/home/username/.ipdr/
└── cids
    └── hello-world
        └── latest
  1. Add cids directory to IPFS:
$ ipfs add -r ~/.ipdr/cids/ --quieter
QmVtjwa3kdFJHce2wnFuygaCHdSPXraBd4FRSEZKjqZWQp
  1. Set _dnslink TXT record on the domain to point to the directory IPFS hash:
dnslink=/ipfs/QmVtjwa3kdFJHce2wnFuygaCHdSPXraBd4FRSEZKjqZWQp
  1. Verify DNS changes:
$ dig _dnslink.example.com -t TXT +short
"dnslink=/ipfs/QmVtjwa3kdFJHce2wnFuygaCHdSPXraBd4FRSEZKjqZWQp"
  1. Re-run server, now with domain as resolver:
$ ipdr server --cid-resolver=example.com
  1. Now we can run ipdr dig to get CID using repo tag name!
$ ipdr dig hello-world:latest
bafybeiakvswzlopeu573372p5xry47tkc2hhcg5q5rulmbfrnkecrbnt3y

Note: if nothing is returned, then make sure the IPFS gateway is correct.

  1. Next pull and the docker image from IPFS using the resolved CID formatted for docker:
docker pull docker.local:5000/bafybeiakvswzlopeu573372p5xry47tkc2hhcg5q5rulmbfrnkecrbnt3y
docker run docker.local:5000/bafybeiakvswzlopeu573372p5xry47tkc2hhcg5q5rulmbfrnkecrbnt3y

Test

make test

FAQ

Contributing

Pull requests are welcome!

For contributions please create a new branch and submit a pull request for review.

Many thanks to @qiangli and all the contributors that made this package better.

Social

Resources

License

Released under the MIT license.

© Miguel Mota