Docker with systemctl

  docker, dockerfile, systemctl

I created a dockerfile based on Ubuntu 20.04 that changes .bashrc and clones repository from github and starts instalation. (In repository exists file server_install.sh that install the program.)

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 

Instalation starts and everytihing is ok, but at some point during instalation there’s a 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 down

systemctl is installed as described in dockefile. I don’t have an idea how to get rid out of this bug.

Lines of file server_install.sh that contain systemctl:

sudo systemctl daemon-reload
sudo systemctl restart gearman-job-server.service

Source: Docker Questions

LEAVE A COMMENT