j8r / dockerfiles

Repository for my dockerfiles
https://hub.docker.com/u/jrei
ISC License
121 stars 46 forks source link

Unable to run container on Ubuntu 18.04 #19

Closed ahmedrafeq closed 3 years ago

ahmedrafeq commented 3 years ago

Hi, I am using your Dockerfile as a baseline for a container that can join to Microsoft Active Directory. the build process finishes without any error. I am getting the error below when attempting to run the container in privileged mode. _docker: Error response from daemon: OCI runtime create failed: containerlinux.go:367: starting container process caused: exec: "/usr/lib/systemd/systemd": stat /usr/lib/systemd/systemd: no such file or directory: unknown

here is the Dockerfile:

FROM ubuntu:18.04
ENV container docker
ENV LC_ALL C
ENV DEBIAN_FRONTEND noninteractive

RUN sed -i 's/# deb/deb/g' /etc/apt/sources.list

VOLUME ["/sys/fs/cgroup"]
VOLUME ["/run"]

CMD ["/usr/lib/systemd/systemd"]

RUN apt-get update \
    && apt-get install -y systemd systemd-sysv \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN apt-get update && apt-get install -y sssd sssd-dbus adcli krb5-user ntp realmd oddjob oddjob-mkhomedir samba-common

RUN cd /lib/systemd/system/sysinit.target.wants/ \
    && ls | grep -v systemd-tmpfiles-setup | xargs rm -f $1

RUN rm -f /lib/systemd/system/multi-user.target.wants/* \
    /etc/systemd/system/*.wants/* \
    /lib/systemd/system/local-fs.target.wants/* \
    /lib/systemd/system/sockets.target.wants/*udev* \
    /lib/systemd/system/sockets.target.wants/*initctl* \
    /lib/systemd/system/basic.target.wants/* \
    /lib/systemd/system/anaconda.target.wants/* \
    /lib/systemd/system/plymouth* \
    /lib/systemd/system/systemd-update-utmp*

RUN mkdir -p /etc/sssd
COPY sssd.conf /etc/sssd/sssd.conf

COPY krb5.keytab /etc/krb5.keytab
COPY krb5.conf /etc/krb5.conf

COPY idmapd.conf /etc/idmapd.conf

COPY resolv.conf /etc/resolv.conf

COPY rc.local /etc/rc.d/rc.local

ADD configure-nfs.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/configure-nfs.sh
RUN chmod +x /etc/rc.d/rc.local

I'd appreciate any guidance you can provide.

Best, AR

j8r commented 3 years ago

I've formatted the text block to be more readable.

j8r commented 3 years ago

The command is in fact CMD ["/lib/systemd/systemd"], not CMD ["/usr/lib/systemd/systemd"]. See https://github.com/j8r/dockerfiles/blob/master/systemd/ubuntu/18.04.Dockerfile#L29, the line is correct.

Why aren't you using jrei/systemd-ubuntu:18.04 as a base image?