Create CentOS base Docker image for PowerPC platform

The following steps will help you to create a CentOS docker image for PowerPC platform from scratch.

The steps below have been performed on a Fedora Little-Endian (LE) guest running on PowerKVM.

Steps to create a CentOS docker image

    • Create a new RPM root directory and set required Environment variables
      # mkdir /centos7-root
      # export rpm_root=/centos7-root
      # export rpm_repo=http://mirror.centos.org/altarch/7/os/ppc64le
      
    • Initialize the new RPM root directory
      # rpm --root ${rpm_root} --initdb

      The rest of the install instructions will use this new RPM root as the install destination for a minimalistic CentOS installation.

    • Install the centos-release rpm package for the CentOS version. For example I’m using the available centos-release rpm package for PowerPC LE architecture from the repository.
      # rpm --root ${rpm_root} -ivh ${rpm_repo}/Packages/centos-release-7-2.1511.el7.centos.2.9.altarch.ppc64le.rpm
    • Import GPG keys
      # rpm --root ${rpm_root} --import ${rpm_repo}/RPM-GPG-KEY-CentOS-SIG-AltArch-7-ppc64le
      # rpm --root ${rpm_root} --import ${rpm_repo}/RPM-GPG-KEY-CentOS-7
    • Install minimal OS
      # yum -y --installroot=${rpm_root} install yum

      This will create a minimalist CentOS install under /centos7-root

    • Additional Customization
      Chroot to the new CentOS installation and perform any additional customization if required

      # chroot ${rpm_root} /bin/bash
      bash-4.2# cat /etc/centos-release
      CentOS Linux release 7.2.1511 (AltArch)
      
    • Convert this CentOS installation to a docker image
      # tar -C ${rpm_root}/ -cJvf centos-7.2.1511-docker.tar.xz .
      # cat centos-7.2.1511-docker.tar.xz | docker import - centos7le
        6625f1dae67ae1311fa28e49c2c766175ccdc717194b7ca3454dd5bf364ef4e1
      # docker images
        REPOSITORY        TAG           IMAGE ID            CREATED             VIRTUAL SIZE
        centos7le         latest        6625f1dae67a        11 seconds ago      342.7 MB

      Another option is to use Dockerfile like the following CentOS Dockerfile for Intel and build the docker image using the above tar ball.

Pradipta Kumar Banerjee

I'm a Cloud and Linux/ OpenSource enthusiast, with 16 years of industry experience at IBM. You can find more details about me here - Linkedin

You may also like...