Docker is very popular nowadays and lots of companies try to use containerization technologies on different kind of platforms. Raspberry Pi has its own place on this containerization world in a special way. In this tutorial, I will mention about how to deploy contanierized Node.js application into Raspberry Pi 3 by using Jenkins.
Prerequisites
- Raspberry Pi (In this tutorial I will use Raspberry Pi 3)
- Mini SD Card
- USB Adapter for Mini SD Card
- Power Cable for Raspberry Pi
- External Display with HDMI support
Prepare Operating System Image
The first thing we need to do is transferring os to Raspberry Pi with an OS installation manager called NOOBS (New Out Of Box Software). Download it from here and transfer the contents of zip file to empty SD card. Be sure that, the files extracted from zip file should be in root level folder of SD card, not in another folder.
First Boot
Connect HDMI display to Raspberry Pi, insert SD card into correct socket in Raspberry Pi, and connect your keyboard into USB socket on Raspberyy Pi.
Once, you connect power cable to Raspberry Pi, the operation system inside SD card will be automatically booted up.
Select Raspbian with PIXEL here and continue to installation.
SSH Configuration
OS installation is finished and we are able to connect to Raspberry Pi. In order to do that, we need to allow SSH connection first. Go to Raspberry Pi > Preferences > Raspberry Pi Configuration.
On the screen, click on Interfaces tab then enable SSH.
Connecting to Raspberry Pi
We need to detect IP address of Raspberry Pi now. Connect your Raspberry Pi with your internet modem with Cat5 cable (you can see network socket on Raspberry Pi). Go to your modem management web ui and grab ip address of connected Raspberry Pi. Connect to Raspberry Pi with;
ssh pi@<ip_address_of_raspberry_pi>
you need to provide default password which is raspberry.
Docker Installation
After connecting to Raspberry Pi, we are ready to install docker with a single command;
curl -sSL https://get.docker.com | sh
After successfull installation, you will see Docker client and server version with command;
docker version
We all set it up, and now we can use our Raspberry Pi as our dedicated server 🙂
Conclusion
To sum up, we have prepared a Raspberry Pi device where Docker installed to apply our DevOps fantasies according to our dreams 🙂 In following articles, I will be talking about how we achieved to replace hard core circuits and special devices with Raspberry Pi in order to use microservices for intercommunication instead of writing libraries an drivers to make devices communicate each other.