Running Cento8 Docker image on Slackware Host
by ricky_cardo from LinuxQuestions.org on (#5KVHQ)
The why is for some work related project, I just want to match env exactly.
So I'm stuck with out a working systemd in the container.
--If I can't get to the bottom I'll just use Virtualbox.
Dockerfile:
Code:FROM centos:latest
MAINTAINER "NA" <bla@gmail.com>
ENV container docker
RUN yum -y update; yum clean all
RUN yum -y install systemd; yum clean all; \
(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*; \
rm -f /etc/systemd/system/*.wants/*; \
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*; \
rm -f /lib/systemd/system/anaconda.target.wants/*;
EXPOSE 443
EXPOSE 80
VOLUME [ "/sys/fs/cgroup" ]
CMD ["/usr/sbin/init"]then build local with:
Code:docker build --rm -t local/c8-systemd .tried the following 4 but all start all yield a container without a working systemd
Code:docker run --name=centos -ti --privileged=true -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /boxee/DOCKER/centos/html/:/var/www/html -p 80:80 -p 443:443 local/c8-systemd
docker run --name=centos -ti --tmpfs /tmp --tmpfs /run -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /boxee/DOCKER/centos/html/:/var/www/html -p 80:80 -p 443:443 local/c8-systemd
docker run --name=centos -ti --privileged=true --tmpfs /tmp --tmpfs /run -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /boxee/DOCKER/centos/html/:/var/www/html -p 80:80 -p 443:443 local/c8-systemd
docker run --name=centos -ti --privileged=true --cap-add SYS_ADMIN --tmpfs /tmp --tmpfs /run -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /boxee/DOCKER/centos/html/:/var/www/html -p 80:80 -p 443:443 local/c8-systemd
The error message is: (the autofs4, only appears when I added --cap-add SYS_ADMIN)
Code:Failed to insert module 'autofs4': No such file or directory
systemd 239 (239-45.el8_4.1) running in system mode. (+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=legacy)
Detected virtualization docker.
Detected architecture x86-64.
Welcome to CentOS Linux 8!
Set hostname to <36522765f70e>.
Cannot determine cgroup we are running in: No data available
Failed to allocate manager object: No data available
[!!!!!!] Failed to allocate manager object, freezing.
Freezing execution.If anyone has suggestions I'd appreciate it, or else I can punt and make a Virtualbox vm
So I'm stuck with out a working systemd in the container.
--If I can't get to the bottom I'll just use Virtualbox.
Dockerfile:
Code:FROM centos:latest
MAINTAINER "NA" <bla@gmail.com>
ENV container docker
RUN yum -y update; yum clean all
RUN yum -y install systemd; yum clean all; \
(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*; \
rm -f /etc/systemd/system/*.wants/*; \
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*; \
rm -f /lib/systemd/system/anaconda.target.wants/*;
EXPOSE 443
EXPOSE 80
VOLUME [ "/sys/fs/cgroup" ]
CMD ["/usr/sbin/init"]then build local with:
Code:docker build --rm -t local/c8-systemd .tried the following 4 but all start all yield a container without a working systemd
Code:docker run --name=centos -ti --privileged=true -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /boxee/DOCKER/centos/html/:/var/www/html -p 80:80 -p 443:443 local/c8-systemd
docker run --name=centos -ti --tmpfs /tmp --tmpfs /run -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /boxee/DOCKER/centos/html/:/var/www/html -p 80:80 -p 443:443 local/c8-systemd
docker run --name=centos -ti --privileged=true --tmpfs /tmp --tmpfs /run -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /boxee/DOCKER/centos/html/:/var/www/html -p 80:80 -p 443:443 local/c8-systemd
docker run --name=centos -ti --privileged=true --cap-add SYS_ADMIN --tmpfs /tmp --tmpfs /run -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /boxee/DOCKER/centos/html/:/var/www/html -p 80:80 -p 443:443 local/c8-systemd
The error message is: (the autofs4, only appears when I added --cap-add SYS_ADMIN)
Code:Failed to insert module 'autofs4': No such file or directory
systemd 239 (239-45.el8_4.1) running in system mode. (+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=legacy)
Detected virtualization docker.
Detected architecture x86-64.
Welcome to CentOS Linux 8!
Set hostname to <36522765f70e>.
Cannot determine cgroup we are running in: No data available
Failed to allocate manager object: No data available
[!!!!!!] Failed to allocate manager object, freezing.
Freezing execution.If anyone has suggestions I'd appreciate it, or else I can punt and make a Virtualbox vm