Containers over RPI: test a Docker environment with Raspbian Buster Lite and Portainer

With the new Rasbian Buster available, it’s interesting to check if some basilar installations are going to be as simple as with previous version.

Today’s goal is to setup a docker environment and Portainer with Raspbian Buster Lite. It will  be tested on a Raspberry Pi model A+, but the procedure is the same also for other Raspberry Pi hardware (Pi 3, PI4, Pi Zero, etc).

What we need

To setup our docker environment using the new Raspberry Pi model A+, we’ll not use keyboards or TV cables. Our OS installation will provide a basis having already WiFi and SSH ready to be used at first boot.

HARDWARE

  • Raspberry PI 3 model A+ kit (including at least also case, USB adapater and power supply)
  • 1 micro SD card (at least 8 GB, preferrably class 10) with an SD adapter

SOFTWARE

  • Raspbian Buster Lite disk image (you can download it from here, used version 4.19)
  • an image flashing software like, for example, Etcher
  • a remote ssh software (like Putty if you’re working from a Windows remote PC)

Step-by-step guide to setup Docker

Setup process is really simple.

The first part involves standard OS installation, which can be found in our previous article that you can find here.

Before proceeding, be sure to have an updated OS:

sudo apt-get update
sudo apt-get upgrade

NOTE: if you experience an error message like the following:

E: Repository 'http://raspbian.raspberrypi.org/raspbian buster InRelease' changed its 'Suite' value from 'testing' to 'stable'
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.

then, this is caused by the Buster release change to Stable. The following should fix this:

sudo apt-get update --allow-releaseinfo-change

 

The default (and suggested) Docker installation, at the date of this article (10th Jul 2019) is currently not working. So the following command:

curl -sSL https://get.docker.com | sh

could result in an error. In this case, a workaround has been identified in github. If you already tried with the default installer, please use the following commands:

sudo rm /etc/apt/sources.list.d/docker.list
curl -sL get.docker.com | sed 's/9)/10)/' | sh

In other words, this seems to install docker with old Stretch repository. However, now docker is ready and running. Test it by typing:

sudo docker version

If you would like to use Docker as a non-root user, you should now consider adding your user to the “docker” group. To accomplish it for default pi user:

sudo usermod -aG docker pi

You will need to logout and login (or reboot) to make it working or you will have still permission issues using docker without sudo.

Installing Portainer

A graceful web GUI helping in managing containers is portainer. In our case, we need to install an arm compatible version:

docker pull portainer/portainer:linux-arm
docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer:linux-arm

Now you can reach your docker server with a browser, just connecting to https://<<RaspberryIpAddress>>:9000.

You will be required to set your default password for admin user, then you will be prompted to portainer GUI:

Portainer new

Enjoy!

FINAL CONSIDERATIONS

At the date of this article, Raspbian Buster seems to be still affected from some issues and appears to be premature.

For the moment, I suggest to use previous Raspbian OS (Stretch) for working environments and Buster only for testing purposes, at least untill these issues will be solved.

Please follow and like us:
error