Run BOINC with docker

2020/12/30

Categories: logiciel Tags: boinc

I have already written an article about BOINC without going through its installation. The classic installation of BOINC is done by downloading the BOINC client, but it is also possible to use BOINC in a Docker container.

This installation method is easier to script and automate, which makes it very interesting on a headless server for example.

Docker installation

First of all, let’s install Docker and Docker-compose. On a Linux distribution using the apt package manager (like Debian or Ubuntu), just install the packages docker.io and docker-compose.

sudo apt install docker.io docker-compose

Make sure the Docker service is running with:

sudo systemctl enable --now docker

It is also recommended to add the current user to the docker group so you don’t have to use sudo every time you run a docker command (replace $USER by your username).

usermod -a -G boinc $USER

Reconnect or restart for the new rights to be applied.

Starting the docker container

In the directory of your choice, create a file docker-compose.yml with the following content:

version: '2'
services:
  boinc:
    image: boinc/client:latest
    container_name: boinc
    restart: always
    network_mode: host
    pid: host
    volumes:
      - /opt/appdata/boinc:/var/lib/boinc
    environment:
      - BOINC_GUI_RPC_PASSWORD=$BOINC_PASSWORD
      - BOINC_CMD_LINE_OPTIONS=--allow_remote_gui_rpc

If you are using an ARM architecture, you will have to choose another image :

Then create in the same directory a file named .env containing the BOINC password:

BOINC_PASSWORD=password

You can then start the container with:

docker-composes up -d

Another command to be aware of is the command to stop the container:

docker-composes down

Managing BOINC

To manage the BOINC client running in docker, there are two options :

Via a BOINC client on another computer

From the BOINC client on another computer, use File > select computer.

You will then be able to enter the IP address of the target computer as well as the password you previously chose to log in.

Via the boinccmd command

It is also possible to control BOINC directly with the boinccmd utility.

To connect to an existing account for a specific project:

docker exec -it docker boinccmd --lookup_account $URL $EMAIL $PASSWORD
# if an account exists, a key will be displayed
docker exec -it docker boinccmd --project_attach $URL $KEY

To create an account for a project:

docker exec -it docker boinccmd --create_account $URL $EMAIL $PASSWORD $USERNAME

To connect to an account manager (https://bam.boincstats.com for example):

docker exec -it boinc boinccmd --join_acct_mgr $URL $USERNAME $PASSWORD

To get the status of BOINC:

docker exec -it boinc boinccmd --get_simple_gui_info
>> Home