(我是Docker初学者.然后我关注了CentOS-7的一些教程)
在我CentOS 7.2,我尝试按照以下步骤学习Docker.
# docker version
Client:
Version: 1.10.3
API version: 1.22
Go version: go1.5.3
Git commit: 20f81dd
Built: Thu Mar 10 15:39:25 2016
OS/Arch: linux/amd64
Server:
Version: 1.10.3
API version: 1.22
Go version: go1.5.3
Git commit: 20f81dd
Built: Thu Mar 10 15:39:25 2016
OS/Arch: linux/amd64
# docker pull centos:latest
# docker images
centos latest 778a53015523 12 days ago 196.7 MB
# mkdir ~/docker/centos7-systemd
# cd ~/docker/centos7-systemd
# vi Dockerfile
FROM centos
MAINTAINER "XXXX XXXX" <xxxx@xxxx.com>
ENV container …Run Code Online (Sandbox Code Playgroud) 我需要使用systemctl从远程计算机自动运行node.js脚本.
我已经创建了一个.service文件并将其放入/etc/systemd/system/.这是.service文件:
[Unit]
Description=laporan
[Service]
ExecStart=/var/www/laporan/nodeserver/server.js
Restart=always
User=nobody
Group=root
Environment=PATH=/usr/bin:/usr/local/bin
Environment=NODE_ENV=production
WorkingDirectory=/var/www/laporan/nodeserver
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
但每次我尝试启动服务时,都会返回如下错误(输出systemctl status laporan):
? laporan.service - laporan
Loaded: loaded (/etc/systemd/system/laporan.service; enabled)
Active: failed (Result: start-limit) since Mon 2016-09-12 09:15:06 WITA; 11min ago
Process: 121690 ExecStart=/var/www/laporan/nodeserver/server.js (code=exited, status=203/EXEC)
Main PID: 121690 (code=exited, status=203/EXEC)
Sep 12 09:15:05 kominfomdc systemd[1]: Unit laporan.service entered failed state.
Sep 12 09:15:06 kominfomdc systemd[1]: laporan.service start request repeated too quickly, refusing to start.
Sep 12 09:15:06 kominfomdc systemd[1]: Failed …Run Code Online (Sandbox Code Playgroud) 我在Redhat 7.1上有一个服务,我使用systemctl启动,停止,重启和状态来控制.有一次systemctl状态返回活动,但是服务"后面"的应用程序响应了不同于200的http代码.
我知道我可以使用Monit或Nagios来检查并执行systemctl重启 - 但我想知道在使用systemd时是否存在默认值,因此我不需要安装其他工具.
我的首选解决方案是,如果http返回代码完全不同于200而不使用systemd本身以外的其他工具,则重新启动我的服务 - (并且可能有可能通知Hipchat房间或发送电子邮件......)
我试过谷歌搜索主题 - 没有运气.请帮忙 :-)
Systemd 支持别名。例如“httpd.service”
ls -l /etc/systemd/system/httpd.service
/etc/systemd/system/httpd.service -> /usr/lib/systemd/system/apache2.service
Run Code Online (Sandbox Code Playgroud)
该文件的内容:
[Unit]
Description=The Apache Webserver
...
[Install]
WantedBy=multi-user.target
Alias=httpd.service apache.service
Run Code Online (Sandbox Code Playgroud)
我想解析脚本中的别名。
例子:
如果输入是“httpd.service”,那么输出应该是“apache2.service”
我可以使用 shell 或 python 来执行此脚本。
如何通过 systemd 方式做到这一点?
读取符号链接可能会起作用,但我想有一种更正式的方法来解析别名。
http://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic.html#INISCRPTACT
根据此 systemctl status 有一个特殊的返回代码列表,它返回有关您正在查询的服务的信息。
如果请求状态操作,初始化脚本将返回以下退出状态代码。
Run Code Online (Sandbox Code Playgroud)0 program is running or service is OK 1 program is dead and /var/run pid file exists 2 program is dead and /var/lock lock file exists 3 program is not running 4 program or service status is unknown 5-99 reserved for future LSB use 100-149 reserved for distribution use 150-199 reserved for application use 200-254 reserved
没关系,但我对 1 并不意味着systemctl status它本身失败(不是底层服务)这一事实感到惊讶。
我正在编写一个脚本,用于查询正在启动的服务的状态,因此我希望看到状态代码 3 几次,然后是 0。但是当“命令systemctl status是 brazoke”?
我很想说任何 5+ 的错误都是不可恢复的错误,我应该放弃等待服务的出现,但这并不是本文档具体所说的内容。它只是提供一般预订。
如果有任何帮助,我正在使用 …
新的 DAG 或对现有 DAG 的更改不会显示在 Airflow Web 服务器上以供在应用程序中使用。
例如。假设我在 DAG 目录中添加一个新的 DAG:
$ airflow dags list那么 dag 就会出现。select dag_id from dag;,则存在新的 dag。因此它被拾取并放入数据库中。dag_code,源代码没有被更新dag_code。$ airflow db init再次运行,那么更改就会生效并且一切正常......所以我的系统是稳定且可用的,因为我正在破解以下功能:$ airflow db init。由于运行此命令不会影响数据库中的数据,因此我实际上可以像这样工作,只需在每次发生更改时运行该命令即可。但我担心,因为这并没有按预期发挥作用,它可能掩盖了更深层次的问题。
任何帮助将不胜感激。我在下面列出了我的系统规格和气流设置。
airflow.cfg相关参数: …
我有一个运行 Ubuntu 16.04 的 docker,并尝试在其中安装 mysql-server。安装很顺利 ( apt-get install -y mysql-server),现在是时候运行服务器了:
systemctl status mysql
Failed to connect to bus: No such file or directory
Run Code Online (Sandbox Code Playgroud)
如何查找/安装 Ubuntu 16.04 (docker) 的 systemctl 以及是否有替代方案?
Dockerfile
FROM centos:7
ENV container docker
VOLUME ["/sys/fs/cgroup"]
RUN yum -y update
RUN yum install -y httpd
RUN systemctl start httpd.service
ADD . /code
WORKDIR /code
Run Code Online (Sandbox Code Playgroud)
泊坞窗,compose.yml
version: '2'
services:
web:
privileged: true
build: .
ports:
- "80:80"
volumes:
- .:/code
Run Code Online (Sandbox Code Playgroud)
命令
docker-compose build
Run Code Online (Sandbox Code Playgroud)
错误:
第6步:运行systemctl启动httpd.service --->运行中5989c6576ac9 [91mFailed得到d-bus接口:不允许操作[0分[31mERROR [0米:???服务 '网站' 未能建立:命令"/bin/sh -c syste mctl start httpd.service'返回非零代码:1
Obs:在Windows 7上运行:(
有提示吗?
我有一个自定义的 systemd “.service” 文件,如下所示:
[Unit]
Description=MyStuff
After=syslog.target
After=network.target
After=local-fs.target
After=remote-fs.target
[Service]
Type=simple
User=root
Group=root
ExecStart=/usr/local/MyStuff/start
ExecReload=/bin/kill $MAINPID && /usr/bin/cat /var/run/MyStuff.pid | /usr/bin/xargs --no-run-if-empty /bin/kill
ExecStop=/bin/kill $MAINPID && /usr/bin/cat /var/run/MyStuff.pid | /usr/bin/xargs --no-run-if-empty /bin/kill
ExecStartPost=/usr/local/MyStuff/after_start.sh
PIDFile=/var/run/MyStuff.pid
#RemainAfterExit=yes
TimeoutSec=300
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
直到几分钟前它都运行良好。Asystemctl stop MyStuff挂这样:
[root@Live-1 ffmpeg]# systemctl status WowzaStreamingEngine
? MyStuff.service - MyStuff
Loaded: loaded (/usr/lib/systemd/system/MyStuff.service; enabled; vendor preset: disabled)
Active: deactivating (final-sigkill) (Result: timeout) since vie 2017-07-28 11:12:23 -03; 23min ago
Main PID: 25149
CGroup: /system.slice/MyStuff.service
jul …Run Code Online (Sandbox Code Playgroud) 我正在使用来自 docker hub 的 archlinux/base 官方镜像。
我正在尝试使用 systemctl 并且它说。
$ docker run --rm -it ac16c4b756ed systemctl start httpd
System has not been booted with systemd as init system (PID 1). Can't operate.
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题。