问题原文
原帖链接 · Nickolay Olshevsky · CC BY-SA 4.0
I'm attempting to use RHEL 9 via the redhat/ubi9 Docker image, having redhat individual developer subscription. However, on attempt to use subscription-manager, got this error message: subscription-manager is disabled when running inside a container. Please refer to your host system for subscription management..
Am I supposed to configure something on macOS level, or configure in container itself?
For RHEL 8 image (redhat/ubi8) everything works well.
社区高分解答
原帖链接 · Wong Hoi Sing Edison · CC BY-SA 4.0
All you need is just a return False from in_container(), See https://github.com/candlepin/subscription-manager/blob/subscription-manager-1.28.32-1/src/rhsm/config.py#L105-L114:
FROM registry.access.redhat.com/ubi7/ubi
ARG REDHAT_USERNAME
ARG REDHAT_PASSWORD
RUN sed -i 's/\(def in_container():\)/\1\n return False/g' /usr/lib64/python*/*-packages/rhsm/config.py
RUN subscription-manager register --username $REDHAT_USERNAME --password $REDHAT_PASSWORD --auto-attach
RUN yum update -y
RUN subscription-manager unregister
FROM registry.access.redhat.com/ubi8/ubi
ARG REDHAT_USERNAME
ARG REDHAT_PASSWORD
RUN sed -i 's/\(def in_container():\)/\1\n return False/g' /usr/lib64/python*/*-packages/rhsm/config.py
RUN subscription-manager register --username $REDHAT_USERNAME --password $REDHAT_PASSWORD --auto-attach
RUN yum update -y
RUN subscription-manager unregister
FROM registry.access.redhat.com/ubi9/ubi
ARG REDHAT_USERNAME
ARG REDHAT_PASSWORD
RUN sed -i 's/\(def in_container():\)/\1\n return False/g' /usr/lib64/python*/*-packages/rhsm/config.py
RUN subscription-manager register --username $REDHAT_USERNAME --password $REDHAT_PASSWORD --auto-attach
RUN yum update -y
RUN subscription-manager unregister
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
