Running Docker on Raspberry Pi 3 with CentOS 7 as a base image

Datetime:2016-09-10 05:26:10         Topic: Raspberry Pi  Centos  Docker          Share        Original >>
Here to See The Original Article!!!

In theprevious post, I showed how to get Docker 1.12.1 up and running on Raspberry Pi3 in just 5 minutes. Under 1.12.1 release, Docker Inc. provided a FIRST ARM debian package which can be installed using a single curl command. It works great and there has been numerous Ubuntu, Alpine and Debian based ARM Docker images been built and pushed out to Dockerhub. If you are CentOS/Red Hat user, you might be interested in building CentOS based ARM images on top of Raspberry Pi. As of today, there is NO CentOS based Docker image available for ARM architecture under Dockerhub. I had few of legacy application which only runs on CentOS based system and hence decided to build one of my own.This step-by-step guide will help you to build platform on top of which you can build CentOS based Docker ARM images.

Step-1: Download the CentOS 7 specific ARM image from the official CentOS website.

root@raspberry5:/# wget http://mirror.centos.org/altarch/7/isos/armhfp/CentOS-Userland-7-armv7hl-Minimal-1603-RaspberryPi3.img.xz

Luckily, I found that CentOS community has ARM images availability for all popular vendors such as  BananaPi, CubieTruck, Pi2 and Pi3. I picked up the right one which will work for my Pi 3 box.

Step-2:  Format your microSD card in case you have old Raspbian OS using SD Formatter(Referhere)

Step-3: Use Win32 disk imager to burn it directly into microSD card.

Step-4: Insert into microSD slot of your Pi 3 box and power it on.

The default username & password is root/centos. This is a minimal CentOS 7 ARM image and hence don’t expect GUI out of this image. By default, WiFi is not enabled. Refer README file under the root directory to get WiFi working. I had a small cable to connect to my router and the network just worked out of the box. I installed vncserver using YUM and could connect to the Pi 3 box without any issue.

Step-5:  Ensure that you run “yum update” to get the latest ARM packages for CentOS 7

Step-6: By default, 2GB is the size allocated for / root partition. Follow the below step for expanding it to utilize the full 12GB of the space.

$sudo git clone https://github.com/ctyler/rootfs-resize

$sudo touch /.rootfs-repartition

$sudo systemctl reboot

Step-7:Now configure the YUM repo to pick up the required packages for Docker. I did a little tweaking here by including RPMs available from foreign unofficial repository.

Ensure that you run ‘yum command’ to get the latest packages for Docker packages.

Step-8: Run the below command to get the required number of packages to be installed:

$sudo yum install lxc bridge-utils device-mapper device-mapper-libs \

libsqlite3x docker-registry docker-storage-setup docker-io

Ensure that you run the below command to start the docker service:

$sudo systemctl start docker.service

Step-9: Verify if Docker is installed or not on Raspberry Pi 3 through ‘docker version’ utility:

You can get the detailed information about Docker  through ‘docker info’ command:

Yipee ! You got Docker installed on your CentOS base image on Raspberry Pi 3 box for the first time.

Let’s quickly try to pull few of the container from Dockerhub.

One can quickly start a container as shown below:

I just got a platform to build a monitoring solution for my data center which I have been waiting for so long. In the next post, I am planning to show you how to build CentOS based Docker images.








New

Put your ads here, just $200 per month.