我在编译Docker镜像时,出现错误,如下图
[root@3e8a57de9554 ~]# rpm -ivh aksusbd-10.11-1.aarch64.rpm
Verifying... ################################# [100%]
Preparing... ################################# [100%]
The installation of the RTE is only supported on Linux systems that use systemd. If you are attempting to install the RTE within a Docker container, be aware that systemd is typically not supported inside Docker, even if it is present on the host system. Refer to the RTE documentation for guidance on how to proceed with Docker.
error: %prein(aksusbd-10.11-1.aarch64) scriptlet failed, exit status 7
error: aksusbd-10.11-1.aarch64: install failed
[root@3e8a57de9554 ~]#
Dockerfile
FROM dockerpull.com/library/rockylinux:9.3
USER root
ADD aksusbd-10.11.1/pkg/aksusbd-10.11-1.aarch64.rpm ~/
RUN yum install systemd -y
RUN rpm -ivh ~/aksusbd-10.11-1.aarch64.rpm
aksusbd-10.11-1.aarch64.rpm 位于 Sentinel_LDK.tar.gz
我对Linux不是很熟悉,查了很多资料,但没有找到类似的问题,怎么办?
The reason for this issue is that the aksusbd software needs to be started with the systemd daemon after installation, but Docker does not recommend starting the systemd process inside the container, and the official rockylinux image does not have the systemd image installed My solution here is to manually create the "/run/systemd/system" directory before installing aksusbd. There will be warnings during the installation process but no errors. Then, when using the container, start aksusbd first and execute the required programs.
My Dockerfile is as follows:
FROM centos:7.9.2009
# 安装插件
RUN export DOCKER_RES_URL=http://172.16.31.68:17637 && \
rm -rf /etc/yum.repos.d/*.repo && \
$DOCKER_RES_URL/WenQuanZhengHei-1.ttf && \
curl -o /etc/hasplm/hasplm.ini --create-dirs $DOCKER_RES_URL/hasplm.ini && \
curl -o /root/setup_hasp.sh $DOCKER_RES_URL/setup_hasp.sh && chmod 755 /root/setup_hasp.sh && \
curl -o /root/hasp.rpm $DOCKER_RES_URL/aksusbd-8.53-1.x86_64.rpm && \
curl -o /root/jdk.rpm $DOCKER_RES_URL/amazon-corretto-8-x64-linux-jdk.rpm && \
curl -o /etc/yum.repos.d/CentOS-Base.repo $DOCKER_RES_URL/Centos-7.repo && \
curl -o /etc/yum.repos.d/epel.repo $DOCKER_RES_URL/epel-7.repo && \
mkdir -p /run/systemd/system && \
rpm -Uvh /root/hasp.rpm && rm -rf /root/hasp.rpm && \
yum clean all && rm -rf /var/cache/yum/*