0

My host system is windows 10 and I would like to build a Docker image based on rhel7-atomic.

Dockerfile:
FROM registry.access.redhat.com/rhel7-atomic
RUN microdnf --enablerepo=rhel-7-server-rpms \
install java-1.8.0-openjdk-headless --nodocs ;\
microdnf clean all

Source: Introducing the Red Hat Enterprise Linux Atomic Base Image

Output:

 $ docker build --force-rm=true --no-cache=true -t=rhel .
 Sending build context to Docker daemon  5.632kB Step 1/2 : FROM
 registry.access.redhat.com/rhel7-atomic  ---> 4364d4c393ff Step 2/2 :
 RUN microdnf --enablerepo=rhel-7-server-rpms                 install
 java-1.8.0-openjdk-headless --nodocs ;microdnf clean all  ---> Running
 in 87b753f6bded

 (process:6): librhsm-WARNING **: 07:20:18.402: Found 0 entitlement
 certificates

 (process:6): librhsm-WARNING **: 07:20:18.404: Found 0 entitlement
 certificates error: (--enablerepo) repo rhel-7-server-rpms not found

 (process:8): librhsm-WARNING **: 07:20:18.433: Found 0 entitlement
 certificates

 (process:8): librhsm-WARNING **: 07:20:18.435: Found 0 entitlement
 certificates Complete. Removing intermediate container 87b753f6bded 
 ---> 77d1aebf6942 Successfully built 77d1aebf6942 Successfully tagged rhel:latest

I also tried it with yum but I get the same error.

The Problem hereby is, that I need to have a subscription for my host. I registered myself on developers.redhat.com, but I can't run subscription-manager within the dockerfile, because the command could not be found. I found another question here that states that the host machine has to have a subscription: Rhel7 atomic docker base image subscription

So it seems that the only way registering my host and attach a valid subscription is to download official rhel ISO image and run it on an VM, subscribe this host system within the VM to redhat and build my docker image there.

What I don't like about that way is, that I have to download 7 GB rhel image and spin up a VM only because of the missing subscription

Is this correct? Or is there another way which I am missing ?

Would it be a better solution to use CentOS or Fedora as Base Images for the docker build instead?

Or aren't the subscriptions my problem but the docker installation on windows 10: https://access.redhat.com/discussions/3219221

snukone
  • 101
  • 2

1 Answers1

0

The issue is Docker on Windows 10 doesn't know the Red Hat secret sauce and the host isn't offering a subscription for the container to inherit. To get this to work, you'll need to run the build on a host with a subscription using the docker package from the Red Hat yum repositories.

I would recommend CentOS to start out with assuming you need Red Hat compatibility down the line. i.e. Maybe this is a POC which needs to run on RHEL images/hosts in production.