Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not get the Dockerfile for systemd base image with the steps mentioned #22

Closed
amitadpsl opened this issue Jun 2, 2015 · 9 comments

Comments

@amitadpsl
Copy link

Hi

When i try to create the image frm the first dockerfile mentioned at:
https://github.com/docker-library/docs/tree/master/centos --- Dockerfile for systemd base image
I get the following:
Step 3 : RUN yum -y swap -- remove fakesystemd -- install systemd systemd-libs
---> Running in ac2363ba55ca
Loaded plugins: fastestmirror
No Match for argument: fakesystemd
swap remove fakesystemd
---> 9dde46f4a0dc

Agter going thru the 2nd dockerfile and starting the image with
docker run --privileged -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -p 80:80 local/c7-systemd-httpd

It still gives the error:
Failed to get D-Bus connection: No connection to service manager.

PLease help or suggest a image that has the basic things in plave.
Failed to get D-Bus connection: No connection to service manage

@jperrin
Copy link
Collaborator

jperrin commented Jun 2, 2015

There is no fakesystemd in the container anymore. there's a pending pull request for docker's documentation
instead of fakesystemd, use systemd-container.
your command would look like yum -y swap -- remove systemd-container -- install systemd systemd-libs

@jperrin
Copy link
Collaborator

jperrin commented Jun 2, 2015

If it will help, I'm happy to build/publish a systemd enabled container to the u/centos namespace.

@amitadpsl
Copy link
Author

HI
Building the image with the above command throws the error:
Transaction check error:
file /usr/lib64/libsystemd-daemon.so.0.0.10 from install of systemd-libs-208-20.el7_1.3.x86_64 conflicts with file from package systemd-container-libs-208.20-6.el7.centos.x86_64
file /usr/lib64/libsystemd-id128.so.0.0.26 from install of systemd-libs-208-20.el7_1.3.x86_64 conflicts with file from package systemd-container-libs-208.20-6.el7.centos.x86_64
file /usr/lib64/libsystemd-journal.so.0.11.3 from install of systemd-libs-208-20.el7_1.3.x86_64 conflicts with file from package systemd-container-libs-208.20-6.el7.centos.x86_64
file /usr/lib64/libsystemd-login.so.0.9.1 from install of systemd-libs-208-20.el7_1.3.x86_64 conflicts with file from package systemd-container-libs-208.20-6.el7.centos.x86_64
file /usr/lib64/libudev.so.1.4.0 from install of systemd-libs-208-20.el7_1.3.x86_64 conflicts with file from package systemd-container-libs-208.20-6.el7.centos.x86_64
file /usr/lib64/security/pam_systemd.so from install of systemd-libs-208-20.el7_1.3.x86_64 conflicts with file from package systemd-container-libs-208.20-6.el7.centos.x86_64

Error Summary

If you could publish the systemd enabled image it will be of great help

@jperrin
Copy link
Collaborator

jperrin commented Jun 5, 2015

I'm looking at this today, and realize I neglected to mention, does systemd-container not work for you?

It has most of the systemd functionality, without some of the problematic parts.

It can be used with the existing CentOS containers, like so:

FROM centos:latest 
MAINTAINER Jim Perrin <jperrin@centos.org> 

ENV container=docker
RUN yum -y update && yum clean all
RUN yum -y install httpd
RUN systemctl enable httpd.service

VOLUME ["/run", "/tmp", "/sys/fs/cgroup"]
EXPOSE 80
CMD ["/usr/sbin/init"]

@jperrin
Copy link
Collaborator

jperrin commented Jun 5, 2015

For full systemd, you can use this:

FROM centos:latest
MAINTAINER Jim Perrin <jperrin@centos.org>

ENV container docker

RUN yum -y swap -- remove systemd-container systemd-container-libs -- install systemd systemd-libs

RUN yum -y update; 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/*;
VOLUME [ "/sys/fs/cgroup" ]
CMD ["/usr/sbin/init"]

@amitadpsl
Copy link
Author

Hey Thanks it did help me build stuff on this image thanks

@kramarama
Copy link

For full systemd, you can use this:

Actually, it doesn't work:

# systemctl status
Failed to get D-Bus connection: Operation not permitted

Any ideas how to get FULL systemd running in docker container with centos 7?

@kramarama
Copy link

Well, it works! I'm running it on Ubuntu Trusty, and I had to add -v /tmp/$(mktemp -d):/run to have the container started with full systemd. All right here!

@jperrin
Copy link
Collaborator

jperrin commented Dec 15, 2015

The updated centos:latest container is now at 7.2 with full systemd installed (though not used by default). I'm going to mark this bug as closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants