In this quick start guide, you will get a feeling of Dragonfly by starting a supernode server in your Docker container, installing the Dragonfly client (the client), and then downloading a container image and a general file, which are likely what you'll be doing frequently in your use case.
You have started your Docker container.
Note: [command]
is optional
-
Pull the docker image we provided.
# Replace ${imageName} with the real image name docker pull ${imageName}
Note: Choose one of the images we provide according to your geo-location, and replace
${imageName}
with it:- China:
registry.cn-hangzhou.aliyuncs.com/dragonflyoss/supernode:0.3.0
- US:
registry.us-west-1.aliyuncs.com/dragonflyoss/supernode:0.3.0
- China:
-
Start a SuperNode.
# Replace ${imageName} with the real image name docker run -d -p 8001:8001 -p 8002:8002 [-v /path/to/supernode:/home/admin/supernode] ${imageName} [-Dsupernode.advertiseIp=private/public supernode ip]
For example, if you're in China, run the following commands:
docker pull registry.cn-hangzhou.aliyuncs.com/dragonflyoss/supernode:0.3.0
docker run -d -p 8001:8001 -p 8002:8002 [-v /path/to/supernode:/home/admin/supernode] registry.cn-hangzhou.aliyuncs.com/dragonflyoss/supernode:0.3.0 [-Dsupernode.advertiseIp=private/public supernode ip]
Note: docker use private ip(docker0 bridge),client cannot access supernode when it run another machine.
You have two options of installing Dragonfly client: installing from source code, or installing by pulling the image.
-
Download a package of the client.
cd $HOME # Replace ${package} with a package appropriate for your operating system and location wget ${package}
Note: Choose one of the packages we provide according to your geo-location, and replace
${package}
with it:-
If you're in China:
-
Linux 64-bit:
http://dragonflyoss.oss-cn-hangzhou.aliyuncs.com/df-client_0.3.0_linux_amd64.tar.gz
-
MacOS 64-bit:
http://dragonflyoss.oss-cn-hangzhou.aliyuncs.com/df-client_0.3.0_darwin_amd64.tar.gz
-
-
If you're not in China:
-
Linux 64-bit:
https://github.com/dragonflyoss/Dragonfly/releases/download/v0.3.0/df-client_0.3.0_linux_amd64.tar.gz
-
MacOS 64-bit:
https://github.com/dragonflyoss/Dragonfly/releases/download/v0.3.0/df-client_0.3.0_darwin_amd64.tar.gz
-
-
-
Unzip the package.
# Replace ${package} with a package appropriate for your operating system and location tar -zxf ${package}
-
Add the directory of
df-client
to yourPATH
environment variable to make sure you can directly usedfget
anddfdaemon
command.# Execute or add this line to ~/.bashrc export PATH=$PATH:$HOME/df-client/
For example, if you're in China and using Linux, run the following commands:
cd $HOME
wget http://dragonflyoss.oss-cn-hangzhou.aliyuncs.com/df-client_0.3.0_linux_amd64.tar.gz
tar -zxf df-client_0.3.0_linux_amd64.tar.gz
# execute or add this line to ~/.bashrc
export PATH=$PATH:$HOME/df-client/
-
Pull the docker image we provided.
docker pull dragonflyoss/dfclient:v0.3.0
-
Start dfdaemon.
cat <<EOD >/etc/dragonfly.conf [node] address=private/public supernode ip EOD docker run -d -p 65001:65001 [-v /path/to/.small-dragonfly:/root/.small-dragonfly -v /etc/dragonfly.conf:/etc/dragonfly.conf] dragonflyoss/dfclient:v0.3.0 --registry https://xxx.xx.x
Note:
- /etc/dragonfly.conf must be set supernode addr
- registry can be private registry like harbor service or mirror url like aliyun mirror,the default value is registry.index.io(In chinese u'll lose connection)
-
Configure the Daemon Mirror.
a. Modify the configuration file
/etc/docker/daemon.json
.vi /etc/docker/daemon.json
Tip: For more information on
/etc/docker/daemon.json
, see Docker documentation.b. Add or update the configuration item
registry-mirrors
in the configuration file."registry-mirrors": ["http://127.0.0.1:65001"]
c. Restart Docker daemon.
systemctl restart docker
Now that you have started your SuperNode, and installed Dragonfly client, you can start downloading images or general files, both of which are supported by Dragonfly, but with slightly different downloading methods.
Once you have installed the Dragonfly client, you can use the dfget
command to download a file.
dfget -u 'https://github.com/dragonflyoss/Dragonfly/blob/master/docs/images/logo.png' -o /tmp/logo.png
Tip: For more information on the dfget command, see dfget.
-
Start
dfdaemon
with a specified registry, such ashttps://index.docker.io
.nohup dfdaemon --registry https://index.docker.io > /dev/null 2>&1 &
-
Add the following line to the dockerd configuration file /etc/docker/daemon.json.
"registry-mirrors": ["http://127.0.0.1:65001"]
-
Restart dockerd.
systemctl restart docker
-
Download an image with Dragonfly.
docker pull nginx:latest