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
centos7.4 systemctl Failed to get D-Bus connection: Operation not permitted #104
Comments
solution:with -rm optiion such as cmd.sh file when compile base image -----------------------business dockerfile------------------------------------------ command to build base image other information |
Your issue is unreadeable! Add some code tag like |
Up please |
Same issue here, except I obtain the error during the Build Time :
My Dockerfile :
Thanks, |
hello experts
according to https://github.com/docker-library/docs/tree/master/centos#systemd-integration
docker build --rm -t local/c7-systemd .
[root@szvphicpra31005 systemddockerfile]# docker build --rm -t local/c7-systemd .
Sending build context to Docker daemon 2.56 kB
Step 1/5 : FROM centos:7
---> 2d194b392dd1
Step 2/5 : ENV container docker
---> Running in a3f2620de0fe
---> 389ecdd1fbe8
Removing intermediate container a3f2620de0fe
Step 3/5 : 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/*;
---> Running in 0bd9b2653955
---> a26fdc1712dd
Removing intermediate container 0bd9b2653955
Step 4/5 : VOLUME /sys/fs/cgroup
---> Running in 6159dd8f4ca1
---> 1433aca36e39
Removing intermediate container 6159dd8f4ca1
Step 5/5 : CMD /usr/sbin/init
---> Running in 791a6376b0fd
---> 4922bc8d4b2a
Removing intermediate container 791a6376b0fd
Successfully built 4922bc8d4b2a
[root@szvphicpra31005 systemddockerfile]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
local/c7-systemd latest 4922bc8d4b2a 6 minutes ago 195 MB
business Dockerfile :do not confused with the attached systemd 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 YourOwnAccountInHuaweiSuchasc00286473:YourOwnPassword@proxyus3.huawei.com:8080/
ENV https_proxy YourOwnAccountInHuaweiSuchasc00286473:YourOwnPassword@proxyus3.huawei.com:8080/
ENV all_proxy YourOwnAccountInHuaweiSuchasc00286473:YourOwnPassword@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
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
EXPOSE 22
ENTRYPOINT /usr/sbin/sshd -D
CMD ["/usr/sbin/init"]
then build the business docker such as
docker build --rm -t secom:v1 .
run business image as following commad
docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -p 18002:18002 -p 1127:1127 -p 2222:22 --ip 172.20.0.3 --net smbridge -h SmServer --shm-size=36G --name secom secom:v1
enter docker
docker exec -it secom /bin/bash
[root@SmServer packagessm]# systemctl
Failed to get D-Bus connection: Operation not permitted ----can not resolve the problem
[root@SmServer packagessm]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
please help what's wrong?
thanks a lot
The text was updated successfully, but these errors were encountered: