In the previous 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 X86 based legacy application which only runs on CentOS based system and hence decided to build one of my own for ARM. It is important to note that X86 based Docker image is not going to work on Raspberry Pi box.

This step-by-step guide will help you to build the CentOS 7.2 ARM Docker Image.

raspbi

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

 

ic1

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(Refer here)

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

Step-4: Insert microSD card 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.

 

ic4

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.

ic3

Ensure that you run ‘yum update’ command again 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:

ic6

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

ic8

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.

ic10

One can quickly start a container as shown below:

ic11

Let’s build up the first Docker ARM image for Dockerhub so that everyone can use it to build application on RPM based ARM container.

Building a container is a simplified process. All you need is a script which you can pull from this github link.Just run the below command to get CentOS 7.2 up and tested automatically:

[root@centos-rpi3 contrib]# sh mkimage-yum.sh -y /etc/yum.repos.d/CentOS-Base.repo centos7

As you see the above command, I have used CentOS-Base.repo as a source repository to create Docker image successfully. Hence, this image is just 210 MB in size. I am planning to shrink it to lower size soon so that it comes up better than before.

Feel free to pull and try out the first CentOS 7.2 container in your Pi box:

$sudo docker run -i -t –rm centos7:7.2 /bin/bash -c ‘echo success’
success

ic91

This is just awesome ! Now I have a platform to build monitoring tool on top of very tiny Raspberry Pi and this is going to be real fun. Will keep you all posted on the latest findings. Till then, keep Reading !

 

Clap


Ajeet Raina

My name is Ajeet Singh Raina and I am an author of this blogging site. I am a Docker Captain, ARM Innovator & Docker Bangalore Community Leader. I bagged 2 special awards last year(2019) : Firstly, “The Tip of Captain’s Hat Award” at Dockercon 2019, San Francisco and secondly, “2019 Docker Community Award“. I was overwhelmed to receive the first award in front of around 5000 audience.

6 Comments

Joseph · 21st October 2016 at 3:58 am

Howdy would you mind sharing which blog platform you’re working

    ajeetraina · 21st October 2016 at 12:02 pm

    Its wordpress and I am using “Refur” theme

David · 7th December 2016 at 2:02 pm

You are my inhalation, I have few blogs and sometimes run out from to brand.

Wayne · 22nd March 2017 at 4:21 pm

Something wrong when yum install docker-registry

python-backports conflicts with python-backports-lzma

python-backports: python-backports-1.0-8.el7.armv7hl
python-backports-lzma: python-backports-lzma < 0.0.2-8

How to resolve it?

Docker Weekly Roundup | September 11, 2016 - Docker Blog · 18th September 2016 at 3:00 am

[…] CentOS 7.2 ARM Docker Image the building of the first CentOS 7.2 ARM Docker image on Raspberry Pi 3 under the Docker 1.12.1 release done by Docker Captain Ajeet Raina. […]

Assessing the current state of Docker Engine & Tools on Raspberry Pi – Collabnix · 14th November 2016 at 2:58 am

[…] I built the first CentOS 7.2 ARM docker image on Raspberry Pi 3 which I described in detail through my blog. It was well appreciated effort and quite accepted by Docker community. I was trying to build Dell […]

Leave a Reply

Your e-mail address will not be published. Required fields are marked *