【发布时间】:2017-09-21 14:20:53
【问题描述】:
我想在 docker 中运行的 centos7 操作系统中运行 cron。当我尝试启动 crond 时,我得到:
Failed to get D-Bus connection: Operation not permitted
谷歌搜索显示这是因为 systemd 没有运行。但是当我尝试开始时,我得到:
bash-4.2# /usr/lib/systemd/systemd --system --unit=basic.target
systemd 219 running in system mode. (+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD +IDN)
Detected architecture x86-64.
Set hostname to <7232ef24bdc8>.
Initializing machine ID from random generator.
Failed to install release agent, ignoring: No such file or directory
Failed to create root cgroup hierarchy: Read-only file system
Failed to allocate manager object: Read-only file system
有人知道我如何在这里运行 crond 吗?
【问题讨论】:
-
在容器中运行
/usr/sbin/cron -f,而不是通过systemd -
这给了我
No such file or directory。我确实安装了cronie软件包。 -
你用的是哪个centos镜像?
-
FROM centos:centos7
-
如果您将其作为主 CMD 运行,则需要安装
crontabs并运行crond -n,如果要将其作为后台进程运行,则需要安装crond
标签: docker cron centos7 systemd