docker - 在centos 7 docker上的cron(和systemd)

标签 docker cron centos7 systemd

我想在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吗?

最佳答案

我快速检查了docker-systemctl-replacement script是否可以使用。该脚本所做的是读取* .service文件(无需systemd守护程序的帮助),以便它知道如何启动和停止服务。

在“yum install -y cronie”之后,我能够“systemctl.py start crond”,在这种情况下,我可以看到正在运行的进程“/ usr / sbin / crond -n”。可以将systemctl.py安装为默认的CMD,以便它也可以简单地从已保存的镜像启动和停止容器。

关于docker - 在centos 7 docker上的cron(和systemd),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46346431/

相关文章:

由 cron 运行时的 C sleep 方差

node.js - 重启centos服务器后Nodejs API不起作用

linux - Centos 7 - 文本模式设置实用程序(设置命令) - 缺少 "Network Configuration"

docker - 在 docker : Fatal error: Unable to find local grunt 中运行 grunt 时出错

docker - 群清理容器/图像还是我应该运行系统修剪?

docker - 构建docker镜像时如何访问父主机服务?

javascript - 使用 JavaScript 解析 crontab 行

sql-server - 从 Docker 容器中连接到 SQL Server Express 时在评估密码时出现错误

linux - 使用反引号的 Cron 错误

linux - Chef-server-ctl 重新配置/在 Chef 服务器上创建管理员用户