Downloading Files with Dragonfly

Things are done differently when you download container images and download general files with Dragonfly.

Prerequisites

  • You are using Linux operating system.

  • You have installed Python 2.7+, and added the Python directory to the PATH environment variable.

  • The SuperNode service is started.

    Tip: For more information on the dfget command, see dfget. For more information on the installation of supernodes, see Installing Server.

Downloading container images

  1. Specify the supernodes.

    a. Open the Dragonfly configuration file.

    1. vi /etc/dragonfly.conf

    b. Add the IP of supernodes separated by comma to the configuration file.

    1. [node]
    2. address=nodeIp1,nodeIp2
  2. Start the dfget proxy (dfdaemon).

    1. # Start dfdaemon and specify the image repo URL. The default port is `65001`.
    2. dfdaemon --registry https://xxx.xx.x
    3. # Review dfdaemon logs
    4. tailf ~/.small-dragonfly/logs/dfdaemon.log

    Tip: To list all available parameters for dfdaemon, run dfdeaemon -h.

  3. Configure the Daemon Mirror.

    a. Modify the configuration file /etc/docker/daemon.json.

    1. 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.

    1. "registry-mirrors": ["http://127.0.0.1:65001"]

    c. Restart Docker daemon.

    1. systemctl restart docker
  4. Download an image with Dragonfly.

    1. docker pull {imageName}

    Note: Don’t include the image repo URL in {imageName}, because the repo URL has been specified with the registry parameter when starting dfdaemon.

Downloading General Files

  1. Specify the supernodes in one of the following ways.

    • Specifying with the configuration file.

      1. # Open the Dragonfly configuration file.
      2. vi /etc/dragonfly.conf
      3. # Add the IP of supernodes separated by comma to the configuration file
      4. [node]
      5. address=nodeIp1,nodeIp2
    • Specifying with the parameter in the command line.

      1. dfget -u "http://www.taobao.com" -o /tmp/test.html --node nodeIp1,nodeIp2

      Note: When using this method, you must add the node parameter every time when you run the dfget command. And the parameter in the command line takes precedence over the configuration file.

  2. Download general files with Dragonfly in one of the following ways.

    • Download files with the default /etc/dragonfly.conf configuration.

      1. dfget --url "http://xxx.xx.x"

      Tip: To list all available parameters for dfget, run dfget -h.

    • Download files with your specified supernodes.

      1. dfget --url "http://xxx.xx.x" --node "127.0.0.1"
    • Download files to your specified output file.

      1. dfget --url "http://xxx.xx.x" -o a.txt

After this Task

To review the downloading log, run less ~/.small-dragonfly/logs/dfclient.log.