Docker and servers

Run Sparebyte with Docker

The image name will be published here when the Linux build is released;<sparebyte-image> below stands in for it.

For an always-on device such as a home server, a NAS, or a Raspberry Pi. The Sparebyte agent runs in a container as a normal user, needs no special rights, and keeps its link to your account in a named volume. It serves a small page on your home network where you link it, pause it, and set a daily cap; the commands below do the same.

What you need

  • Docker on Linux, on a 64-bit Intel or AMD processor, a 64-bit ARM board (Raspberry Pi 3, 4 or 5 with a 64-bit system), or a 32-bit ARMv7 board (Raspberry Pi 2 or 3 with a 32-bit system). One image covers all three; Docker picks the right one.
  • A Sparebyte account. You can create it when you open the link.
  • An internet connection that allows outgoing UDP on port 443. You do not need to open or forward any port on your router.

1. Start the agent

docker volume create sparebyte-data
docker run -d --name sparebyte --restart unless-stopped \
  -p 8377:8377 -v sparebyte-data:/data <sparebyte-image>

The volume sparebyte-data holds the device’s key, its link to your account, and your settings. Keep it when you update. To give the device a name in your dashboard, add -e SB_DEVICE_NAME="Living room Pi" before the image name.

-p 8377:8377 publishes the device’s own page. Leave it out if you only want the commands.

On a phone or computer on the same home network, open http://<the device's address>:8377, for example http://192.168.1.20:8377. The page shows a code, a QR code, and the button Open the setup page. Open it (or scan the QR code with your phone), sign in or create your account, and check that the code matches. The device then connects and starts sharing. You never type your password into the device’s page or the agent.

Without the page, the agent prints the same code and link in its log:

docker logs sparebyte

Look for the lines Link this device: and Code:; the line after them names the page’s address.

The page has no password: anyone on your home network can open it and pause the device or change its cap. It shows no account details. Do not forward port 8377 from the internet to the device.

To check on it later:

docker exec sparebyte sparebyte status

docker ps shows the container as healthy while the agent is connected, or waiting for its code to be confirmed.

3. Pause and resume

On the device’s page, press Pause or Resume. Or with commands:

docker exec sparebyte sparebyte pause
docker exec sparebyte sparebyte resume

While paused, the device stays connected but carries no traffic, and your dashboard shows it as not sharing. A pause lasts until you resume, even across restarts.

4. Set a daily data cap

On the device’s page, press Change cap and enter a number of GB per day. Or with commands:

docker exec sparebyte sparebyte set-cap 5000000000
docker exec sparebyte sparebyte set-cap off

The cap is in bytes: 5000000000 is 5 GB a day. It counts traffic in both directions. Once the device has carried that much, it stops sharing until the day ends at midnight UTC, then starts again by itself. Raising or removing the cap resumes sharing within seconds.

You can also set the cap when you start the container, with -e SB_DAILY_CAP_BYTES=5000000000. That value wins over set-cap until you start the container without it; 0 means no cap.

5. Updates

The container keeps the agent up to date by itself: it checks for a new version when it starts and every few hours, downloads it, checks its signature, and restarts the agent with it. The device stays linked and keeps its pause and cap settings. The device’s page and docker exec sparebyte sparebyte status show the version and whether it is up to date.

To turn this off, start the container with -e SB_AUTO_UPDATE=off. Then update by pulling the new image and starting the container again:

docker pull <sparebyte-image>
docker stop sparebyte
docker rm sparebyte
docker run -d --name sparebyte --restart unless-stopped \
  -p 8377:8377 -e SB_AUTO_UPDATE=off -v sparebyte-data:/data <sparebyte-image>

With updates off, your dashboard marks the device “Update needed soon” and we email you before its version stops working. To see which version you run: docker exec sparebyte sparebyte --version.

6. Remove the agent

  1. In your Sparebyte dashboard, remove the device from your devices.
  2. Delete the container, its volume, and the image:
docker rm -f sparebyte
docker volume rm sparebyte-data
docker image rm <sparebyte-image>

Nothing else is left on the machine.