1 Star 0 Fork 19

user_499098 / Dragonfly

forked from Gitee 极速下载 / Dragonfly 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 3.65 KB
一键复制 编辑 原始数据 按行查看 历史

Dragonfly Quick Start

Dragonfly Quick Start document aims to help you to quick start Dragonfly journey. This experiment is quite easy and simplified.

If you are using Dragonfly in your production environment to handle production image distribution, please refer to supernode and dfget's detailed production parameter configuration.

Prerequisites

All steps in this document are done on the same machine using the docker container, so make sure the docker container engine is installed and started on your machine. You can also refer to the documentation: multi-machine deployment to experience Dragonfly.

Step 1: Deploy Dragonfly Server (SuperNode)

docker run -d --name supernode --restart=always -p 8001:8001 -p 8002:8002 -v /home/admin/supernode:/home/admin/supernode dragonflyoss/supernode:0.4.3

Step 2: Deploy Dragonfly Client (dfclient)

SUPERNODE_IP=`docker inspect supernode -f '{{.NetworkSettings.Networks.bridge.IPAddress}}'`
docker run -d --name dfclient --restart=always -p 65001:65001 -v $HOME/.small-dragonfly:/root/.small-dragonfly dragonflyoss/dfclient:0.4.3 --registry https://index.docker.io --node $SUPERNODE_IP

NOTE:

  • The --registry parameter specifies the mirrored image registry address, and https://index.docker.io is the address of official image registry, you can also set it to the other non-https image registries.
  • The --node parameter specifies the supernode's address in the format of HOST:IP. And the default value 8002 will be used if the port is not specified. Here we use docker inspect to get the ip of supernode container as the host value. Since the supernode container exposes its ports, you can specify this parameter to node ip address as well.

Step 3. Configure Docker Daemon

We need to modify the Docker Daemon configuration to use the Dragonfly as a pull through registry.

  1. Add or update the configuration item registry-mirrors in the configuration file/etc/docker/daemon.json.
{
  "registry-mirrors": ["http://127.0.0.1:65001"]
}

Tip: For more information on /etc/docker/daemon.json, see Docker documentation.

  1. Restart Docker Daemon.
systemctl restart docker

Step 4: Pull images with Dragonfly

Through the above steps, we can start to validate if Dragonfly works as expected.

And you can pull the image as usual, for example:

docker pull nginx:latest

Step 5: Validate Dragonfly

You can execute the following command to check if the nginx image is distributed via Dragonfly.

docker exec dfclient grep 'downloading piece' /root/.small-dragonfly/logs/dfclient.log

If the output of command above has content like

2019-03-29 15:49:53.913 INFO sign:96027-1553845785.119 : downloading piece:{"taskID":"00a0503ea12457638ebbef5d0bfae51f9e8e0a0a349312c211f26f53beb93cdc","superNode":"127.0.0.1","dstCid":"127.0.0.1-95953-1553845720.488","range":"67108864-71303167","result":503,"status":701,"pieceSize":4194304,"pieceNum":16}

then Dragonfly is proved to work successfully.

SEE ALSO

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/yunwisdoms/Dragonfly.git
git@gitee.com:yunwisdoms/Dragonfly.git
yunwisdoms
Dragonfly
Dragonfly
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891