In this article, we will show you how to install OpenSpeedTest (https://OpenSpeedTest.com) in Docker (https://docker.com) on a Raspberry Pi. If you are starting completely from scratch, first go check out my other blog post titled Raspberry Pi 4 Boot with USB. We will be starting right where that article left off.
If you find this article or any of my other articles helpful, you can always:
First, you will want to ensure that your Raspberry Pi is completely up to date:
sudo apt update && sudo apt upgrade -y
If you just set up the Raspberry Pi based on the other article that I linked to, you shouldn’t have any updates, but it’s always a good idea to check anyway.
Next, let’s install Docker. Docker allows you to run applications and operating systems in ‘containers’ – which makes them very easy to upgrade as well as portable so that you can move them between servers and scale them as needed. What you can accomplish with Docker is overwhelming, so we aren’t going to cover much of Docker here, but I highly suggest checking it out in more depth.
curl -sSL https://get.docker.com | sh
That should take less than 1 minute. Once Docker is installed, we need to give our Pi user rights to manage Docker containers by adding it to the ‘docker’ group:
sudo usermod -aG docker pi
Next, we are going to install Portainer (https://portainer.io). Portainer is an open source container management GUI. Basically, it gives us a graphical user interface for managing our Docker instance (and other Docker servers as well if you want). Oddly enough, Portainer itself is going to be installed in a Docker container – so the Docker management GUI lives in Docker – it’s like Docker inception.
Install Portainer – this first step pulls down the Docker image:
sudo docker pull portainer/portainer-ce:linux-arm
Then install Portainer in Docker:
sudo docker run --restart always -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:linux-arm
Both of these commands together should take less than a minute to run. Now that Portainer is installed, you can browse to it by opening http://[Raspberry Pi IP address]:9000. You can find your Raspberry Pi IP by running:
If, for instance, your IP address is 192.168.200.122, the Portainer interface will be found at http://192.168.200.122:9000. Put that into a browser, and you should be the Portainer setup wizard.
*** NOTE: By default Portainer uses HTTP, not HTTPS – so if it isn’t opening for you, make sure you’re using http:// instead of https://.
The first thing you will see is Portainer asking you for your administrative credentials. You can set your Portainer administrative credentials to whatever you want, but for ease of use, I set mine equal to my Pi user – so, username Pi, and then the password that I use for the Raspberry Pi.
You will first be asked which Portainer instance you want to connect to – in our case, we want Portainer to use the local Docker instance, so click on ‘Docker’ and then click ‘Connect.’
This will now bring you to the Portainer dashboard where you should see 1 image, and 1 container (which would be Portainer itself). If you click on ‘Containers’ you can control your container instances – stop/start, change ports or networking, etc. We aren’t going to dive into Portainer in this article, but it’s a nice add-on for this project.
Now onto installing OpenSpeedTest. Drop back to SSH and run:
sudo docker run --restart=unless-stopped --name=openspeedtest -d -p 80:8080 openspeedtest/latest
That’s it – you’re done. If you now browse to http://[Raspberry Pi IP Address] you will get to OpenSpeedTest, and simply click ‘Start’ to run the speed test.
One thing that I have found in my testing is that the max I’m able to get when speed testing against the Raspberry Pi is ~750Mbps download and ~950Mbps upload – or in other words, I seem to get full Gigabit speeds on the upload, but only about 3/4 speed on the download. Not sure what the bottleneck is, but it shouldn’t be the M.2 drive – perhaps the shared USB bus that connects the M.2 drive? If you have any insight into that, let me know in the comments below and I’ll update the blog post accordingly!
Thanks for checking out this tutorial – if you found it helpful, you can always:
I installed on a Ubuntu 20 server image on a RPi4, I only had to change this part here:
sudo docker run –restart always -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:linux-arm
For “portainer-ce:linux-arm64” at the end.
I have gotten 950-960 in both directions reliably. Often 900/950 (up/down). And I’m running on a microSD card, so I don’t believe the speed of the drive has any impact.
Hello ! Thank you for the great step by step instruction ! I almost made it with your recipe, but in the end, browsing the test page through ” http://[Raspberry Pi IP Address]” did not work. So I tried with
“docker run –restart=unless-stopped –name=openspeedtest -d -p 3000:3000 openspeedtest/latest”
according to the openspeedtest page, then tried http://[Raspberry Pi IP Address]:3000
then the page for the test showed up.
I suppose ” http://[Raspberry Pi IP Address]” should have also gotten a port number ? I’m a total noob, I think the port number has something to do with ” 80:8080″ in your docker run command, but I can’t tell.
what size SD card would be good to for the rasbian image and all the rest ?
Hi Cris, I had mostly the same results as Fred and Johanna. I have the Rpi4 with an SSD over USB3 and my speed tests are 980/980 symetrical. I think the bottleneck is really the 32bit OS. But for the ports, my port 80 is alredy in use, I used the ports recomended by the openspeedtest folks. With the command:
sudo docker run –restart=unless-stopped –name openspeedtest -d -p 3000:3000 -p 3001:3001 openspeedtest/latest
This makes the http on 3000 and https on 3001, but for https you can provide your own ssl cert.
Thanks for the tutorial.
I actually used
docker run –restart=unless-stopped –name openspeedtest -d -p 3000:3000 -p 3001:3001 openspeedtest/latest
from the Openspeedtest.com website, then I had to put in http://pi_ip_address:3000
Then it worked.
is there a way to automate and log this information ?
Yes of course – with the Raspberry Pi platform and Linux, you usually find a way to do whatever you can think of.