Create A Crypto Miner Docker Image

Yigit Kader
3 min readNov 17, 2021

Hello all,

I would like share how we can mining a coin(simply) and how we can dockerize this. End of this document i will share docker image built my me.

If you dont know what is mining and docker, Please check this websites.

Now lets keep go on.

For this mining we will look to Monero coin .

Firstly let download Monero from https://www.getmonero.org.You can check the website later.

You can select simple mode after lets create our wallet. Get your wallet address and hide important informations

Now lets create our Dockerfile

FROM ubuntu:latestLABEL OWNER="CREATED BY YIGIT KADER"LABEL GITHUB="github.com/ryigitkader"ENV WORKER=dockerworkerENV WALLET=45DnQfVYTyH9dwpQ2q8Sf4AixfK4uxe66JSfcE2KjyqmCYKA5Gprjx8VkFgU1KdBAhEMafkeVWb4c46fneFVDQTPGXbNCDzENV POOL=gulf.moneroocean.stream:10128ENV VERSION=masterRUN apt-get update && DEBIAN_FRONTEND="noninteractive" TZ="America/New_York" apt-get install -y tzdataRUN apt install git build-essential cmake libuv1-dev libssl-dev libhwloc-dev -yRUN apt-get -y install cmakeRUN git clone https://github.com/xmrig/xmrig.gitRUN cd xmrig &&  git checkout ${VERSION} &&  mkdir build &&  cmake . . && makeWORKDIR    /xmrigCMD [ "sh","-c","./xmrig -o ${POOL} -u ${WALLET} -p ${WORKER}"]

It should look like this

I will explain simply what we do in this Dockerfile

+ Get latest ubuntu
+ Declare you environment variables what we need
+ Update ubuntu packages
+ install some packages what we need
+ Build system files with cmake
+ Start Mining
There are two mandatory fields
-Wallet address
-Pool address

Now we will build our dockerfile

Now Starting mining

Here you can see the processes.

You can find docker image and code repository here

To sum up, Actually you can not earn much monero, because of it is hard to solve hashing algorithm. Sometimes you can do it but it could be rejected because of someone find this hash before you. But it was fun .

I hope you liked :)

I will glad if you give a star for this repository..

--

--