我创建了一个基于Ubuntu20.04的dockerfile,用于更改.bashrc并从github克隆存储库并启动安装。(在存储库中存在安装程序的server_install.sh文件。)
Dockerfile:
FROM ubuntu:20.04
USER root
LABEL maintainer="zarooba"
ENV TZ=Europe/Warsaw
ENV DEBIAN_FRONTEND=noninteractive
ADD aamks_bashrc.txt /root
RUN touch /root/.bashrc && cat /root/aamks_bashrc.txt >> /root/.bashrc
RUN apt-get update
RUN apt-get install -y python3
RUN apt-get install -y git
WORKDIR /usr/local
RUN git clone https://github.com/aamks/aamks.git
RUN ["chmod", "+x", "/usr/local/aamks/installer/server_install.sh"]
RUN apt-get update -y && \
apt-get -y install sudo && \
apt-get install -y systemd
CMD /usr/local/aamks/installer/server_install.sh 安装开始了,一切正常,但在安装过程中的某一点上有一个bug:
Bug with systemctl: System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is downsystemctl按照dockefile中所述进行安装。我不知道如何摆脱这个bug。
包含systemctl的文件server_install.sh行:
sudo systemctl daemon-reload
sudo systemctl restart gearman-job-server.service发布于 2021-08-05 18:55:17
所有docker运行脚本都将在一个容器中启动,在该容器中您无法控制PID 1。实际上,它是您尝试在其中执行的脚本。如果它是另一个服务,那么有时在每个stp中启动/停止进程是很有帮助的。
RUN dbctl start ; execdb -c "CREATE USER"; dbctl stop使用docker-systemctl-replacement脚本可以解决此问题,该脚本可以截获systemctl执行,并且还可以根据需要启动/停止所需的服务。这允许您在容器中运行面向VM的"server_install“(无需为其打补丁)
https://stackoverflow.com/questions/68483021
复制相似问题