Using Decentralized Docker Hub, you can easily push and pull docker images from IPFS and filecoin. It is powered by Powergate. It also has support for ENS domain names.
-
Install Docker and Docker compose
https://docs.docker.com/engine/install/#server https://docs.docker.com/compose/install/
Install Go 1.15
Once Go is installed then add the following to ~/.bashrc
export GOPATH=$HOME/go export PATH="$GOPATH/bin:$PATH"
Then run the following command
source ~/.bashrc
-
Run Powergate, Lotus and IPFS containers
Ensure that make is installed for your OS
git clone --depth 1 --branch v1.2.4 https://github.com/textileio/powergate.git cd powergate make install-pow make install-powd cd docker BIGSECTORS=true make localnet
Replace the last command above with
make up
for using filecoin mainnet instead of localnetFor hosted powergate instance provided by Textile, you can skip the last step and set POW_SERVERADDRESS env variable.
-
Create a Powergate user from a new tab and note down the token from the output
pow admin user create
For hosted powergate provided by textile, set the following admin token as an env variable before running the above command (hosted powergate admin APIs are protected using admin token)
export POW_ADMIN_TOKEN=
-
Add token as the environment variable
export POW_TOKEN={token}
Replace {token} in the above command with the actual token
-
Determine the docker image that you want to push to IPFS and filecoin
You can either create a new docker image locally or fetch it from another source
You can check the list of existing docker images in your local machine using
docker image ls
For this tutorial lets use
alpine
docker image since it is a lightweight Linux distribution -
Clone Decentralized Docker Hub repo
git clone https://github.com/viraja1/decentralized_docker_hub.git cd decentralized_docker_hub
-
Push alpine image to IPFS and filecoin
./ddocker push alpine
Note down the IPFS cid from the output since it will be required for the next step
-
Pull alpine image from IPFS and filecoin
./ddocker pull {cid}
Replace {cid} with the IPFS cid noted from the previous step
-
Create a test container
docker container run -it -d alpine
-
Install GO (1.15 or above)
-
Install Ethereal Command line tool
Ensure that gcc is installed for your OS before installing ethereal
GO111MODULE=on go get github.com/wealdtech/ethereal@latest
-
Get the IPFS hash of the docker image and set it as the content hash of your ENS domain
-
Pull docker image from IPFS and filecoin using ENS domain name
./ddocker pull {ens_domain_name}
Replace {ens_domain_name} with the actual ENS domain name (defaults to ENS mainnet)
For ropsten or other testnet, you can specify network at the end
e.g.
./ddocker pull alpine.docker.eth ropsten
https://ipfs.io/ipfs/QmPKru6chbbjxJXWRyNEEY8jmdte2x8ic13bUnrw8Mw7kB/
Decentralized Docker Hub Registry allows you to push and pull docker images from IPFS. It provides a native docker integration via a custom docker registry server (v2). It is powered by Textile Hub and Textile Buckets. It also has support for Fleek Space Daemon. Decentralized Docker Hub Registry has support for encryption and team sharing via Textile Hub. Custom cron scripts can be written to periodically backup the buckets containing the Docker images to Filecoin.
https://github.com/viraja1/decentralized_docker_hub_registry