rhel7上的docker二进制文件未在systemctl中列出

问题描述 投票:0回答:2

[我在守护进程开始使用的RHEL7上使用docker二进制文件

dockerd &

我还需要进行一些配置,为此我需要stpr启动docker,但是我必须终止该进程,并且没有办法停止docker守护程序。

我尝试过:

$ sudo service docker stop

但它说:

Redirecting to /bin/systemctl stop docker.service
Failed to stop docker.service: Unit docker.service not loaded

我可以访问我的容器。我需要找出停止和启动docker的优雅方法,而不是终止进程。请帮助。

docker kill mount rhel binaries
2个回答
0
投票

如果要在主机系统上使用“ systemctl”,请确保确实存在服务描述符。因此,在安装docker之后,请执行“ systemctl daemon-reload”并检查“ systemctl cat docker.service”的结果。


-1
投票

如果您进入centos7版本的docker hub,您正在使用有关如何在启用systemctl的情况下运行centos的说明。在552简短中:

Create a dockerfile and paste:
FROM centos:7
MAINTAINER “you” [email protected]
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” ]
CMD ["/usr/sbin/init"]

Then build the container using in the dir you have created the file (be sure no other files are inside, as they will be taken into the context and may cause troubles :wink: )

docker build --rm -t c7-systemd . (c7-systemd can be replaced with other name)

Then run the image with:
docker run -itd --privileged --name=yourName c7-systemd
© www.soinside.com 2019 - 2024. All rights reserved.