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*
# replace x.x.x with the latest version
wget https://github.com/ipdr/ipdr/releases/download/x.x.x/ipdr_x.x.x_linux_amd64.tar.gz
tar -xvzf ipdr_x.x.x_linux_amd64.tar.gz ipdr
./ipdr --help
# move to bin path
sudo mv ipdr /usr/local/bin/ipdr
$ ipfs daemon
Initializing daemon...
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip4/192.168.86.90/tcp/4001
Swarm listening on /ip6/::1/tcp/4001
Swarm listening on /p2p-circuit/ipfs/QmR29wrbNv3WrMuodwuLiDwvskuZKKeTtcYDw7SwNffzCH
Swarm announcing /ip4/127.0.0.1/tcp/4001
Swarm announcing /ip4/192.168.0.21/tcp/43042
Swarm announcing /ip4/192.168.86.90/tcp/4001
Swarm announcing /ip6/::1/tcp/4001
API server listening on /ip4/0.0.0.0/tcp/5001
Gateway (readonly) server listening on /ip4/0.0.0.0/tcp/8080
Daemon is ready
Add docker.local to /etc/hosts:
echo '127.0.0.1 docker.local' | sudo tee -a /etc/hosts
echo '::1 docker.local' | sudo tee -a /etc/hosts
$ docker pull docker.local:5000/ciqjjwaeoszdgcaasxmlhjuqnhbctgwijqz64w564lrzeyjezcvbj4y
Using default tag: latest
latest: Pulling from ciqjjwaeoszdgcaasxmlhjuqnhbctgwijqz64w564lrzeyjezcvbj4y
Digest: sha256:6b787c9e04c2038d4b3cb0392417abdddfcfd88e10005d970fc751cdcfd6d895
Status: Downloaded newer image for docker.local:5000/ciqjjwaeoszdgcaasxmlhjuqnhbctgwijqz64w564lrzeyjezcvbj4y:latest
Test run:
$ docker run docker.local:5000/ciqjjwaeoszdgcaasxmlhjuqnhbctgwijqz64w564lrzeyjezcvbj4y
hello world
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 helpfor ipdr
Use "ipdr [command] --help"for more information about a command.
IPNS
An example of using IPNS to resolve image tag names.
First start local server:
ipdr server -p 5000
Tag the image:
docker pull hello-world
docker tag hello-world docker.local:5000/hello-world
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
请发表评论