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
Failed to get D-Bus connection: No connection to service manager - CentOS 7 #7459
Comments
@ostechnix You need to use your own process manager in the container. Using A docker container is mostly meant to be used like an *NIX process, not like a full blown VM. Due to this, you should set up supervisor, runit or something else to monitor your processes and start them explicitly (without calling start scripts and systemd tools). As an alternative to running a process supervisor, you could run unprivileged systemd in your container and that would let you us I hope this answers your question. Please feel free to comment. |
@unclejack We used to run /sbin/init as the the command and everything is working well in centos6 . This for example works on https://github.com/paimpozhil/WhatPanel/blob/master/Dockerfile |
This post also claims it is possible to run systemd service within docker http://developerblog.redhat.com/2014/05/05/running-systemd-within-docker-container/ |
mark |
I was able to get SystemD working inside an image built
For some undocumented reason the variable I was using
Output to verify it was working:
However, when I built & ran the same image on a Ubuntu host (via Travis-CI), starting SystemD yields a warning:
The container does indeed keep running, and commands can be run inside it via |
Hi. I have a similar problem running centos 7 in docker. For what it's worth, my case is the following. Three days ago I have pulled a fresh centos 7 image [latest], installed postgresql and was able to run systemctl start postgresql.service. I haven't done much more on it, closed it and committed. When I resumed the work [docker run -t -i myuser/myimage /bin/bash], it returned: |
Finally got systemd working in a Docker container. References: fedora-cloud/docker-brew-fedora#24 moby/moby#7459 Fixes #1 Creating home directory subdirs.
FWIW I'm seeing this on latest centos:centos7 with docker 1.10.2 when starting a custom service.
|
@jamshid Is that still working for you? I pulled the latest centos:7 image today and it seems broken.
|
It's weird, not sure all services need all the workarounds (a service I was testing did not, but nginx did). I added a working Dockerfile and docker-compose.yml here of starting a centos7 /systemd nginx service: https://forums.docker.com/t/any-simple-and-safe-way-to-start-services-on-centos7-systemd/5695/8 |
I am also getting the Both are giving the same error
I am using the latest |
@JoyceBabu, I also get this error on Docker for Mac.
FWIW it does seem to work fine on 1.12.0-rc4 running on a debian jessie aufs system.
|
|
@satyajitbm Using your approach I got this error:
What is your next suggestion? |
@biocyberman Which image is your container based of? Are you trying to run this command?
I have tried using the |
I am also getting the same message when running the above It is working when I used the |
It works when seccomp is disabled; ping @justincormack I think in a recent discussion you mentioned that was no longer required, but looks like it's still blocking something that's needed |
centos 7 is running success,but need login ;append to code for dockerfile |
It works for me with this PR #25567 with just |
I still have the |
@anthony-o #20082 mentions |
I have finally managed to fix this by launching |
mark |
satyajitbm asking for username and password,what we need to pass it? |
Any ideas how to solve this issue with Docker for Windows? I can't use the workaround with adding /sys/fs/cgroup as volume as I don't have this on Windows... |
I am facing weird error like when i run the service script inside container using adhoc ansible command it is working fine. samething if i use inside playook to run a service script inside container it is getting failed :( :( |
@anthony-o Thanks for your solution. I have followed your suggestions, but I still get an error:
My Dockerfile is: #
# SKIL Community Edition (SKIL CE)
# gives developers an easy way to train and deploy powerful deep learning models to production quickly and easily.
# Currently the SKIL Community Edition only supports Centos 7 and Redhat 7 operating systems.
# @see https://skymind.ai/quickstart
#
# Copyright (c) 2017 Loreto Parisi - https://github.com/loretoparisi/docker
#
FROM centos:7
MAINTAINER Loreto Parisi <loretoparisi@gmail.com>
ENV HOME /root
WORKDIR $HOME
# install dependecies
RUN \
yum install -y sudo \
sudo yum clean all \
sudo yum install -y skil-server \
sudo yum install -y policycoreutils
# yum repo config
COPY skymind.repo /etc/yum.repos.d/
# install skil server
RUN \
sudo yum install -y skil-server
# disable SELinux
#RUN \
# disable SELinux temporarily
# setenforce Permissive && \
# disable SELinux permanently
#sudo sed -i 's/SELinux=enforcing/SELinux=disabled/' /etc/sysconfig/selinux
# SELinux check
RUN sestatus
VOLUME /run /tmp
ADD cmd.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/cmd.sh
CMD ["/usr/local/bin/cmd.sh"] I run with I would expect the
While if I try to run like I get a
My
|
solution:with -rm optiion such as
FROM centos:7
ENV container docker
RUN (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" ]
#######added 20180322
ADD cmd.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/cmd.sh
CMD ["/usr/local/bin/cmd.sh"]
#######added 20180322
#######changed 20180322
#CMD ["/usr/sbin/init"]
#######changed 20180322 cmd.sh file when compile base image
########################## build secomanager dockerfile ###########################
FROM local/c7-systemd
MAINTAINER caokun caokun.nj@huawei.com
ENV container docker
ENV TZ Asia/Shanghai
ENV http_proxy c00286473:password@proxyus3.huawei.com:8080/
ENV https_proxy c00286473:password@proxyus3.huawei.com:8080/
ENV all_proxy c00286473:password@proxyus3.huawei.com:8080/
ENV no_proxy=127.0.0.1,.huawei.com,localhost,local,.local,10.120.165.217,*.huawei.com
RUN yum install -y openssh-server vim telnet sudo wget unzip tar gcc openssl lsof service compat-libstdc++-33 systemctl strace
RUN ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
RUN useradd guest
RUN echo "guest:guest!@#" | chpasswd
RUN echo "guest ALL=(ALL) ALL" >> /etc/sudoers
RUN echo "root:Mylinux1" | chpasswd
RUN sed -i '1s/^/set encoding=utf-8\n/' /etc/vimrc
&& echo "set hls" >> /etc/vimrc
&& echo "set expandtab" >> /etc/vimrc
&& echo "set sw=4" >> /etc/vimrc
&& echo "set tabstop=4" >> /etc/vimrc
RUN sudo mkdir /root/packagessm
ADD files/PreInstall_CentOS7.1.zip /root/packagessm/
ADD files/SecoManager_5.1.0.B010_ALL_install_config.zip /root/packagessm/
WORKDIR /root/packagessm
#WORKDIR /root
RUN sudo mkdir /var/run/sshd
#############for ssh
#EXPOSE 22
#ENTRYPOINT /usr/sbin/sshd -D
#############for ssh
CMD ["/usr/sbin/init"] command to build base image
other information
|
|
Without this, we get an error of the form "Failed to get D-Bus connection: No such file or directory" when Ansible attempts to run any systemctl commands. I'm not sure exactly why this is necessary, but I came across it here: moby/moby#7459
Hello All, I really need some help. I have CentOS 7 64bit OS on my testing Laptop. I installed Docker in centos 7, and I am able to create centos 7 container inside docker. But, I could not use "systemct" command inside docker. It throws the error: "Failed to get D-Bus connection: No connection to service manager." I can't start any services like sshd, httpd etc.
When run the systemct commands inside the docker containers I got the above error. I really have no idea about this. Is it a bug or am i missing something?
Example:
bash-4.2# systemctl start sshd
Failed to get D-Bus connection: No connection to service manager.
I have already referred the following threads, but none of them helps. I got the same error.
https://bugzilla.redhat.com/show_bug.cgi?id=1033604
https://lists.fedoraproject.org/pipermail/golang/2013-November/000187.html
https://bbs.archlinux.org/viewtopic.php?id=153738
What to do now? Please help me. Sorry for my poor English.
The text was updated successfully, but these errors were encountered: