Containers over RPI: setup a Docker environment with Raspbian Stretch Lite and Portainer

Today’s goal is to setup a docker environment using the new Raspberry Pi model A+.

In our previous post, we experienced installing RancherOS on Raspberry Pi model B (please find here the referred post). Even if that configuration works well, the missing of a WiFi support on RancherOS for Raspberry is currently a great issue for those people, like me, who wants to try an hardware without ethernet port.

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 Stretch Lite disk image (you can download it fromĀ here, used version 4.14)
  • 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.

You can now install the Docker client on your Raspberry Pi with just one terminal command:

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

Now docker is ready and running.

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 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

Portainer home

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:

Installing Docker-compose

Docker-compose enables your Docker environment to use yaml files to compose and quickly boot complete services. Its installation is very simple, requires pip and can be done with the following commands:

sudo apt-get install python-pip
sudo pip install docker-compose

You can check the correct installation simply by typing:

docker-compose --version

NOTE: if the last command does’t work, this could be linked to a known error. In this case, try with the following:

sudo pip install docker-compose==1.23.2

 

Enjoy!

PS: raspberry boot with docker could take a while to reboot, in order to have docker services up and running. Please, be patient at boot time, after this docker works like a charm.

Please follow and like us:
error