Today’s goal is to setup a docker environment using the new Raspberry Pi model A+. The same procedure applies also for RPI 3 model B, model B+ and should also work with the newer RPI 4.
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.
- 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
- 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.
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:
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:
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