This Docker container automatically downloads and runs the latest version of XMRig, a high-performance RandomX, KawPow, CryptoNight, AstroBWT and GhostRider CPU miner.
Repository: https://github.com/simeononsecurity/xmrig-docker
- Automatically downloads the latest XMRig release
- Runs the RandomX boost script at startup for optimal performance
- Allows custom configuration via mounted config.json
- Supports passing command-line arguments directly to XMRig
- CPU-only mining for maximum compatibility and simplicity
- Docker installed on your system
- MSR modules available on the host (for RandomX optimization)
You can pull the image from either Docker Hub or GitHub Container Registry:
docker pull simeononsecurity/xmrig:latest
docker pull ghcr.io/simeononsecurity/xmrig:latest
docker run --privileged simeononsecurity/xmrig:latest
The --privileged
flag is required to allow the container to run the RandomX boost script, which needs access to MSR (Model-Specific Registers).
You can mount your own config.json
file to override the default configuration:
docker run --privileged -v /path/to/your/config.json:/config/config.json simeononsecurity/xmrig:latest
You can pass arguments directly to XMRig:
docker run --privileged simeononsecurity/xmrig:latest -o pool.example.com:3333 -u YOUR_WALLET_ADDRESS -p x -k
To use NVIDIA GPUs for mining, you need to have the NVIDIA Container Toolkit installed and use the following command:
docker run --privileged --gpus all simeononsecurity/xmrig:latest -o pool.example.com:3333 -u YOUR_WALLET_ADDRESS -p x -k --cuda
The container automatically:
- Detects the presence of NVIDIA GPUs
- Builds the XMRig CUDA plugin from source code
- Configures XMRig to use the CUDA plugin for GPU mining
No additional configuration is required to enable CUDA support. The container includes CUDA Toolkit 12.4 for building the plugin, which supports most modern NVIDIA GPUs. Building from source ensures maximum compatibility and performance.
To use AMD GPUs for mining, you need to pass through the GPU devices:
docker run --privileged --device=/dev/dri:/dev/dri --device=/dev/kfd:/dev/kfd simeononsecurity/xmrig:latest -o pool.example.com:3333 -u YOUR_WALLET_ADDRESS -p x -k --opencl
The included docker-compose.yml
file is pre-configured for both NVIDIA and AMD GPU support. Simply uncomment the relevant sections and run:
docker-compose up -d
docker build -t xmrig .
- Running containers with the
--privileged
flag grants extensive permissions to the container, which could be a security risk. Only use this container in trusted environments. - Always verify the source of Docker images before running them, especially for cryptocurrency mining software.
This Dockerfile and associated scripts are provided under the Apache License 2.0. XMRig itself is subject to its own licensing terms.