How to make custom Docker image

Create Docker image with CryptoDredge miner

First, you should install Docker CE

  • Create new folder and switch there: cd ~ && mkdir test && cd test

  • Download CryptoDredge miner release: wget https://github.com/technobyl/CryptoDredge/releases/download/v0.9.3/CryptoDredge_0.9.3_cuda_9.1_linux.tar.gz

  • Unpack the archive: tar xvf CryptoDredge_0.9.3_cuda_9.1_linux.tar.gz

  • We need only the miner binary file, so let’s copy it to current folder: cp CryptoDredge_0.9.3/CryptoDredge .

  • Create Dockerfile (Docker image description): nano Dockerfile

Dockerfile contents:

FROM nvidia/cuda:9.1-base

COPY run.sh CryptoDredge /

ENTRYPOINT ["/run.sh"]

CryptoDredge needs CUDA, and we will take official CUDA 9.1 image as a basis. In addition, our image will contain two files (CryptoDredge binary, and run.sh — this script will run when container starts).

Create run.sh in current folder. Contents:

#!/bin/bash

#USER-Defind params
if [[ -z "$PARAMS" ]]; then
    echo "Please set env-variable 'PARAMS' for mined funds."
    exit 1
fi

/CryptoDredge ${PARAMS}
  • Don’t forget to make it executable: sudo chmod +x run.sh

  • Now we have to build the Docker image and publish it in DockerHub. But first, register on DockerHub and login to your account in your terminal docker login—username {your_Dockerhub_Username}

  • You may use two commands to build and push your image to DockerHub docker build {docker_image_name}docker push {docker_image_name}

OR you may create Makefile for this:

IMAGE ?= "yourname/cryptodredge:v0.9.3"

all: build push

build:
        docker build -t ${IMAGE}
push:
        docker push &{IMAGE}

And then use make build, make push or just make commands.

If you have NVidia GPU on your PC, you may test your image locally (previously you need to install nvidia-docker2 plugin): docker run -it --runtime=nvidia -e PARAMS=”miner params” {docker_image_name}

An example of how to run a task

Create task.yaml:

container:
  comit_on_stop: false
  image: yourname/cryptodredge:v0.9.3
  env:
    PARAMS: "-a phiZ -o sratum+tcp://bpool.io:8332 -u LMFBZigCMiVqksVXzvXuUcuirtAY7QMtX5"

Create order to rent out someone’s hardware:

# spot deal (0h, supplier may close the deal at any moment), or forward deal duration (fixed time)

duration: 0h
price: 0.03 USD/h

# counterparty: 0x8125721c2413d99a33e351e1f6bb4e56b6b61567

identity: anonymous

# tag: test

resources:
  network:
    overlay: false
    outbound: true
    incoming: false

  benchmarks:
    ram-size: 512000000
    cpu-cores: 1
    cpu-sysbench-single: 500
    cpu-sysbench-multi: 500
    net-download: 1000000
    net-upload: 1000000
    gpu-count: 1
    gpu-mem: 3000000000
    gpu-eth-hashrate: 50000000

You may check out current prices in SONM Profitability calculator (it’s calculations depends on current market demand for resources and may change), and specify your price:

Place order, wait for a deal and start our task.

You may see task logs 4 deals on the screenshot above, to check this image on remote PCs in SONM with different hardware.