Skip to content

Instantly share code, notes, and snippets.

  • Save spuranam/8894b5a2d898f2931376790661ab83d2 to your computer and use it in GitHub Desktop.
Save spuranam/8894b5a2d898f2931376790661ab83d2 to your computer and use it in GitHub Desktop.
The way to build red hat base docker image without subscription managed registered.

In redhat, if you need build container from base image, for example, registry.access.redhat.com/rhel7/rhel:7.3-53 (free download from https://access.redhat.com/containers) You have to build this image on a red hat server with subscription managed registered.

Here is the way to bypass the check and you can build docker image on any redhat 7 server.

make sure the package has been installed

yum install rh-amazon-rhui-client

list the package files

$ rpm -ql rh-amazon-rhui-client
/etc/init.d/choose_repo
/etc/init.d/rh-cloud-firstboot
/etc/pki/rhui/cdn.redhat.com-chain.crt
/etc/pki/rhui/content-rhel7.key
/etc/pki/rhui/product/content-rhel7.crt
/etc/pki/rhui/product/rhui-client-config-server-7.crt
/etc/pki/rhui/rhui-client-config-server-7.key
/etc/yum.repos.d/redhat-rhui-client-config.repo
/etc/yum.repos.d/redhat-rhui.repo
/etc/yum.repos.d/rhui-load-balancers.conf
/etc/yum/pluginconf.d/amazon-id.conf
/etc/yum/pluginconf.d/rhui-lb.conf
/usr/lib/yum-plugins/amazon-id.py
/usr/lib/yum-plugins/amazon-id.pyc
/usr/lib/yum-plugins/amazon-id.pyo
/usr/lib/yum-plugins/rhui-lb.py
/usr/lib/yum-plugins/rhui-lb.pyc
/usr/lib/yum-plugins/rhui-lb.pyo
/usr/sbin/choose_repo.py
/usr/sbin/rh-cloud-firstboot.py

copy above files to local.

rpm -ql rh-amazon-rhui-client |tar cvf package.tar -T -
tar xvf  package.tar 
rm  package.tar

Prepare Dockerfile

FROM registry.access.redhat.com/rhel7/rhel:7.3-53

COPY etc /etc
COPY usr /usr

RUN yum -y update; yum clean all

Build the image

docker build -t rhel7-base . 

Now you still see below message, but yum update will continoue.

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment